Can you suggest best practice for Main Menu organization?

Carolina Tiger Rescue's picture

Our existing website has a pretty clear menu structure:


Tours has a sub-menu of the different tours we offer, plus tour relevant items like Directions, Area Attractions, etc. So in the new site, if the viewer clicks on the Tours option in the menu (rather than clicking on one of the sub-menu items), I would like a page that lists the sub-menu links with a summary.

To do this, I created a view for a tour page that lists the node title and summary, and then used Views PHP module to sort the view by menu weight.

(process described here:

The problem comes with filtering. Each basic page node is listed, regardless of its parent item on the Main Menu. I need to filter the results for the Tour view so that only tour-relevant pages are listed. It's not a problem for "Animals" because I filter by their Content Type, but I'm not sure I should be creating a new Content type for each menu category.

So here are my options:

  1. Create a content type for each of the menu parent items- like I've already done for Animals. Drawback is several of extra Content types that are really just basic pages.
  2. Create a "Menu Categories" taxonomy and filter by that- drawback is that it's one more thing for content managers to specify every time they add content, when they're already specifying this by which menu item it is listed under
  3. Edit my Views PHP to only list "child menu" elements. Drawbacks are that this is a bigger learning curve- not sure how to . If I'm only editing the PHP in the view, it's probably worth doing, but if I have to edit code in the source files- then I would worry that things could get messy when I update my site.

Thoughts? In the meantime, I'll try to figure out how to accomplish this by changing the view's php field

Thanks, Amanda



Carolina Tiger Rescue's picture

It looks like the way I tried to do this was a bit antiquated. Using the Global PHP method as it was described in the link worked, but still had the issue of not being able to filter.

I discovered I could add modules Menu Node API, and Menu Node Views in order to do the same the from the GUI- without needing to add code. Much cleaner. My only complaint is that I can't use the parent menu's name to filter, I have to use its mlid value. But maybe I just haven't found it yet. ;)

next time guys! Amanda

Menu Block

deanflory's picture

Amanda, have you considered the Menu Block module? Am I understanding the issue correctly?

If the issue is about not allowing users that can create nodes to choose where to put the associated menu item, then I'd say those nodes are probably going to be different enough down the road to be different node types and thus solve your problem the easy but more-effort way.

I've found my main menus to generally be basic panel pages and I then create lots of other separate menus to place as blocks in panel pages for more options and in node types for a more focused navigation. I've yet to have a site where "one menu to rule them all" worked to solve all navigation and extra options I wanted to present that were not necessarily part of that node's position's hierarchy.

Cary, North Carolina, USA
Learning something every day...

Honestly, menus are one of

cdmo's picture

Honestly, menus are one of those things in Drupal that I personally find to not be worth the trouble of managing through Drupal. Instead, I create the actual HTML (or PHP) of the menu and include it in my theme (like page.tpl.php). Yes, I know, not the "most Drupal" way to do it, but it's a time-saver and so much simpler IMO.

Yep, done that

Screenack's picture

I've done that at times, too. It depends on who you're handing the site off to. Another option is to manually create your HTML menu lists within a block, so that you don't need file-level access to make modifications. I presume there's a performance benefit to manually-created menus, but I don't know for sure.

coded menus

deanflory's picture

I can't see menus hidden away in tpl files being anything other than trouble if you're building the site for someone else that isn't a Drupal/PHP guru.

You know they're going to want to add a menu item in there sooner than later. Pretty much goes against the whole Content Management System idea.

Cary, North Carolina, USA
Learning something every day...