I have a lingering problem on most all sites I build, and I haven't come up with a perfect fix for it. Wanted to post it to see what others are doing.

In the CMS it is possible to just add new pages that are not at all part of the menu system. Perhaps they are on a category tag page, or perhaps they are just linked to from inline links. Or perhaps they are just old pages and are only accessible through search. Or its user generated content. Or forum/blog posts.

All situations where a page will not be added to the menu tree.

The problem for me arises when designers are using the "active" menu state to indicate the "section" a particular piece of content belongs to.

For instance when I go into a blog post, I want to maintain the blog menu item as active, and maybe also the submenu item with the blog listing. Or if its a more generic content type like "page", I might want to maintain various topically-related nav as active. Just want class="active" added to the href....

I've done overrides of menu_links checking up the active trail - this of course means every piece of content needs to be in the menu system or it doesn't ever call this function, so not the right solution.

I've also added pages to preset categories to test for a page section and then use menu_set_active_item('taxonomy/term/x'); -- my latest site with 6 primary and maybe 12 secondary nav has over 150 lines of code to handle what active state to maintain... and its still not doing it quite right. And menu_set_active_item has some strange behavior, because I think while it is displaying my current page, the underlying system really thinks it is on taxonomy/term/x.

What I've been thinking would be a nice solution to this is a simple form_alter where I can pick what active/section state to hold on any piece of content. And then instead of spoofing it with menu_set_active_item - it just adds an active class to any of the menu/submenu items that are set for a particular node. Curious if this exists and I missed it...

I have seen/read a ton of posts on this topic and I think tried most of the suggested solutions. Curious how others have dealt with the issue... I was hoping to see this issue fixed in D6 menu redo - and maybe it is and I haven't uncovered it yet.

Thanks!
-Greg

Comments

capellic’s picture

ainigma32’s picture

Status: Active » Fixed

This has become a d.o. project: http://drupal.org/project/menutrails

- Arie

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.