Hi! I'm developing this website which is made to a customer who isn't very good at this with administrating websites so I try to keep everything as easy as possible.

Now, the navigation looks like this.

  • Home
  • About us
  • Other stuff...

And when you go to About us, there will be a separate menu that in the blocks area is set up to show up only on the About us page;

About us
  • Our music
  • History
  • And so on...

Now I would wan't to be aple to put the separate "About us"-menu items as children under the main menu, but still have them in a separate

    so I can put them to the right of my header.

    Hope you guys understood...

Comments

arh1’s picture

i believe the best way to handle this is to create the tier1 and tier2 menus as separate menus in Drupal, then use the tier2 menu block's visibility settings to just show it on specific pages.

a simple case would be if you use urls like these...
tier1: example.com/about
tier2: example.com/about/history

then you can set the tier2 menu to only display on urls like: about*

alejandr0’s picture

That's how I do it now but I would like to administrate them both as they were just one menu, a main navigation with children but the children in a separate

  • List
arh1’s picture

hmm, well obviously Drupal spits out nested unordered lists for the menus by default. i'm sure you could override that behavior using some theme function, though i wouldn't be able to tell you where to start... you could possibly split up the menus at the theme layer using CSS positioning, but that seems like a long shot, especially if you want any decent browser compatibility.

but, why would you do this? do you just not want to have 2 separate menus to administer at /admin/build/menu ? i think this'll be way more work than would make that small benefit worthwhile.

alejandr0’s picture

yeah I've tought of using CSS but skipped that idea. do somebody know where to start developing this function or do someone have a complete solution??? pleease.

arh1’s picture

you're going to need to roll up your sleeves, understand the menu system, and do some custom coding to get this done.

check out the menu system API page i linked above. at a glance, menu_tree and menu_get_menu look like good starting points.

alejandr0’s picture

Would Taxonomy do the thing? If I sort all the content up in a special way?

arh1’s picture

i was just nudged toward this technique of splitting menu children into blocks by other forum users. the technique i mentioned above still works better for my sites, but you might find it useful.

54drupal’s picture

I could be off the mark here as I'm new to Drupal but from what I understand you want to display second level navigation on a different part of the page to the primary?

I'm working on a site where the primary navigation is just below the header and the secondary is in a right column.

I add this to header:
<?php if (isset($primary_links)) { ?><?php print theme('links', $primary_links) ?><?php } ?>

and added this to right column

<?php if ($secondary_links): ?>
    <div id="secondary">
	<?php print theme('links', $secondary_links); ?>
     </div> <!-- /#secondary -->
<?php endif; ?>  

I use css to style primary navigation as inline ordered lists and secondary as block displayed ordered lists.

When publishing I just add pages or stories to the Primary Navigation menu and give it a priority.

This gives me secondary navigation only within relevant site sections..

arh1’s picture

no, gg66, i think you're right that this is the best approach, if you can work around the following caveats:

1) (i think) the theme function call only returns one "tier" of menu items rather than the descending menu tree (i.e. if your secondary links have children, they won't be displayed)

2) the secondary links will only be displayed if the current URL is mapped to a corresponding menu item (i believe any "2nd tier" menu item or any of its children). i.e. you can't have a given "2nd tier" menu display at arbitrary URLs.

also check out the theme_menu_tree function.

this is one of those Drupalisms i can't believe i don't have a better handle on yet!

Anonymous’s picture

What about the menu block split module?
http://drupal.org/project/menu_block_split

arh1’s picture

looks interesting, but this is certainly pretty standard functionality that we can/should handle with core (and it really seems mostly like a theming issue, anyway). IMHO it's always always better to avoid adding another contrib module if you can find a way to do it with core. i think approaches like the ones above are manageable, it's just a matter of tuning them.

ndz’s picture

I had the same problem - the solution is very simple.

You should add that code to page.tpl.php in place where you want to have main items:
print theme('links', menu_navigation_links('your_custom_menu_name'));

and that for sub items:
print theme('links', menu_navigation_links('your_custom_menu_name',1));

Greetings