Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-07-06 17:33:45

wavesource
Member
From: Australia
Registered: 2011-08-02
Posts: 56

Menu/Navigation management

Ugh. Look, I know most people here are happy twiddling with HTML, or using adi_menu for simpler site navigations.

I tend to kit up TXP with hak_tinymce, adi_menu, fh-article-image-selector, jbx_multiple_image_upload, rah_section_titles, rss_auto_excerpt, smd_browse_by, upm_file and upm_file_popper just to give the clients some access to what they expect from a modern CMS, and that’s great. Yeah, they like to fling buttons. But as much as I enjoy introducing clients to the purity of TXP, I want my clients, no matter how daft, to be able to love it too.

And in this instance, they can get by with the rest, but I would enjoy better site navigation management included in TXP, at least for my clients’ sakes, something that can (for example) extend adi_menu into a fully capable system that is user-friendly for clients.

Anyway, just venting. I’ve just spent an hour over the past day or two explaining to a client how to use some functions of TXP, not just adi_menu, and I can bring them so far, but when they can’t manage their navigation as well as they can in Wordpress (ugh) then I start to get twitchy.

Last edited by wavesource (2014-07-06 17:34:39)

Offline

#2 2014-07-06 22:11:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Menu/Navigation management

Having never personally used adi_menu (I know, I know: whaaaat?!) I’m unsure of its precise feature set.

Please supply a run-down of how core navigation features are deficient in comparison (i.e. what you’d like the core tags to be able to offer, or the core interface to behave like) and we’ll look into exploring the possibilities.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2014-07-06 22:42:17

wavesource
Member
From: Australia
Registered: 2011-08-02
Posts: 56

Re: Menu/Navigation management

Let’s take a brief look at what adi_menu offers non-coders:

At all levels, parent or children, users can assign sort order numeric to reorder section links.

It will list all sections in the system, but sections can be hidden from menu. The can assign sections as children of other section links, thereby creating a visual hierarchy. Any section link can be redirected to existing sections or you can also assign an existing Link in TXP as target URI (ie.external or internal usage). Any section link can be cloned so it can appear as a child link beneath itself, with Title override, ie. you can have a top level link of Articles repeat as a child named Article Index for the section list view. The admin page also displays a preview of the unordered list generated so users can see what they’re up to.

In the code partial you can get more juice: you can create just a menu for a specified section or sections, set all articles to be listed with sections (this can be quickly a burden, but it’s leavened by being able to specify sections by name not to list articles for…)… gee.

I’ll paste the Help page here because it’s quite detailed and well laid out, saves you a 5 second installation. If you can post a form for a nav that does a lot of this, then I would be happy to reappraise creating tags from scratch!

But it doesn’t do categories in navigation, nor does it go far enough (these days) with class assignation per element which is becoming important, it seems.

Last edited by wavesource (2014-07-25 11:59:43)

Offline

#4 2014-07-06 23:17:01

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Menu/Navigation management

Hi wavesource, adi_menu is one of mine.

As far as categories go, I stuck with sections partially to keep things straightforward but also in the hope that subsections would be introduced into Textpattern core one day. This hasn’t happened and a lot of people use the section/category method to give them “subsections” (although to only one sub level).

adi_menu gives you unlimited subsections in the navigation menus but it’s somewhat of an illusion – the URL structure is still only single section based.

Other than categories, if there are any improvements to adi_menu that would smooth the path of your life … I’m open to suggestions.

Offline

#5 2014-07-07 00:50:14

wavesource
Member
From: Australia
Registered: 2011-08-02
Posts: 56

Re: Menu/Navigation management

Hi gomedia – it’s a great plugin. Yes, I’ve often wondered about the flat hiearchy, but also I can see how it avoids collisions. I’ve never really thought it was a limitation, but I guess an SEO specialist might say there’s joy to be had nesting sections URLs.

One thing I’d like the clients to be able to do is add links without creating sections… ie. right now with adi_menu you can only assign redirections to existing sections. There is no ability to create a virtual/symlink and place it anywhere you like in the hierarchy.

Also, being able to define target – target=”_blank” is very useful per menu link, but I’ve read that it’s not a pure way to do it. Some argue it should be invoked using javascript on the client side.

That would help solve the category menu link because you could just enter the URL for that category without requiring for an automatic function.

I am also dealing with these responsive navigations that are getting more complex, with classes and data-toggle:

<ul class=“nav navbar-nav”> <!— Home —> <li class=“dropdown active”> <a href=”#” class=“dropdown-toggle” data-toggle=“dropdown”> Home </a> <ul class=“dropdown-menu”> <li><a href=”#”>Page 1</a></li> <li><a href=”#”>Page 2</a></li> <li><a href=”#”>Page 3</a></li> </ul> </li> <!— Next link —> <li class=“dropdown”> <a href=”#” class=“dropdown-toggle” data-toggle=“dropdown”> Another Parent </a> <ul class=“dropdown-menu”> <li><a href=”#”>Page 4</a></li> <li><a href=”#”>Page 5</a></li> <li><a href=”#”>Page 6</a></li> </ul> </li> </code> etc.

So injecting these extra classes along with “active” and also data-toggle and second level classes on UL elements, you wonder where it will end and if it is ever something you’d want to automate. But certainly right now using adi_menu in such scenarios is off the table.

Last edited by wavesource (2014-07-07 00:52:46)

Offline

#6 2014-07-07 01:11:23

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Menu/Navigation management

wavesource wrote #281950:

One thing I’d like the clients to be able to do is add links without creating sections… ie. right now with adi_menu you can only assign redirections to existing sections. There is no ability to create a virtual/symlink and place it anywhere you like in the hierarchy.

I know what you mean – I use “dummy” sections & the redirect facility quite a bit. It slots in nicely with the plugin code but one does end up with extra sections. I’ll look at alternatives to see if it’s a “straightforward” thing to implement.

Also, being able to define target – target=”_blank” is very useful per menu link, but I’ve read that it’s not a pure way to do it. Some argue it should be invoked using javascript on the client side.

In the old days, I used to use target=”_blank” all the time, but then got swayed by perceived wisdom. Javascript/jQuery is the way I go now if I choose to ignore the wisdom.

I am also dealing with these responsive navigations that are getting more complex, with classes and data-toggle …
So injecting these extra classes along with “active” and also data-toggle and second level classes on UL elements, you wonder where it will end and if it is ever something you’d want to automate. But certainly right now using adi_menu in such scenarios is off the table.

By default you should see a class of “menuparent” on list items that have submenus (attribute ‘parent_class’), but the data-wotsit is quite probably something where adi_menu should be brought up-to-date on.

I’ll ponder such things & get back to you.

Cheers,

Adi

Offline

#7 2014-07-07 09:59:26

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Menu/Navigation management

wavesource wrote #281950:

One thing I’d like the clients to be able to do is add links without creating sections…

If that can help, here is an easy (even client-wise) way of creating custom menus using links. I have started to work on drag’n‘drop UI, but it’s not ready yet.

I am also dealing with these responsive navigations that are getting more complex, with classes and data-toggle … So injecting these extra classes along with “active” and also data-toggle and second level classes on UL elements, you wonder where it will end and if it is ever something you’d want to automate.

Altering html is the primary purpose of etc_query.

Offline

#8 2014-07-07 12:12:53

wavesource
Member
From: Australia
Registered: 2011-08-02
Posts: 56

Re: Menu/Navigation management

OK, I’ll have a look at etc_query. You guys are freaky. In a good way, of course.

Offline

#9 2014-07-07 16:16:47

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Menu/Navigation management

The included help is rather long, I wouldn’t read it myself. To get you started, assuming the bare adi_menu output is

<ul class="nav navbar-nav">
	<!— Home —>
 	<li class="active">
		<a href="#"> Home </a>
		<ul>
			<li><a href="#">Page 1</a></li>
			<li><a href="#">Page 2</a></li>
			<li><a href="#">Page 3</a></li>
		</ul>
	</li>
	<!— Next link —>
	<li>
		<a href="#"> Another Parent </a>
		<ul>
			<li><a href="#">Page 4</a></li>
			<li><a href="#">Page 5</a></li>
			<li><a href="#">Page 6</a></li>
		</ul>
	</li>
</ul>

here is how you inject the additional attributes:

<txp:etc_query data='<txp:adi_menu_or_whatever />'
	replace="ul/li@@class=dropdown {@class?};
		ul//ul@@class=dropdown-menu;
		ul/li/a@@class=dropdown-toggle@data-toggle=dropdown" />

It all takes (modulo the plugin loading time) less than 0.001s.

Offline

#10 2014-07-07 22:19:42

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Menu/Navigation management

If it helps … adi_menu without any attributes produces something like:

<ul id="mainmenu" class="section_list">
	<li><a class="active_class" href="#">Non-parent 1</a></li>
	<li class="menuparent">
		<a href="#">Parent 1</a>
		<ul>
			<li><a href="#">Child 1</a></li>
			<li><a href="#">Child 2</a></li>
			<li><a href="#">Child 3</a></li>
		</ul>
	</li>
	<li class="menuparent">
		<a href="#">Parent 2</a>
		<ul>
			<li><a href="#">Child 4</a></li>
			<li><a href="#">Child 5</a></li>
		</ul>
	</li>
	<li><a href="#">Non-parent 2</a></li>
</ul>

and if you use list_id="1", all <li> elements get a unique ID as well

Offline

#11 2014-07-07 23:47:00

wavesource
Member
From: Australia
Registered: 2011-08-02
Posts: 56

Re: Menu/Navigation management

adi_menu is almost there as is, but I think etc’s plugin is magic. I had no idea it existed, it looks like it can revolutionise how I apply classes everywhere in forms etc. in that I can structure classes/ids from wherever I invoke the forms/plugins directly in pages etc. Brilliant. And I guess I’m only scratching the surface…

Offline

#12 2014-07-16 09:44:56

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Menu/Navigation management

There’s a beta version of adi_menu available for testing that introduces the concept of virtual sections. If you’re interested read more here.

Offline

Board footer

Powered by FluxBB