Output secondary links as a menu tree
Thanks for this posting goes to rapidsynergy for posting the solution in this comment on the Drupal forum.
Problem: You're using $secondary_links to display the children of the active menu item in $primary_links, but $secondary_links has children too and they aren't displaying when their parent becomes active.
Solution: Add the following snippet to your template.php file:
<?php
/**
* Output $secondary_links as a menu tree.
*/
function secondary_menu_tree() {
// get the menu items that lead to the current menu item
$active_trail =_menu_get_active_trail();
// get the menu id of the active top-level link
$mid = $active_trail[0];
// get the primary menus id
$pmid = variable_get('menu_primary_menu', 0);
//do they match?
if ($active_trail[0] == $pmid) {
return theme('menu_tree', $active_trail[1]); //create a tree starting from level 2
}
}
?>Now, add the following line to your theme wherever you want to show the secondary menu items:
<?php print secondary_menu_tree(); ?>Comments
Gregory at 19:29 on 24-Jan-2012
So is this site already lapsed its domain expiration due then? Too bad when sites keep on redirecting you to new locations. Just when you're about to get the feel of the site then this redirection happens. By the way, you posting tips on output secondary links as a menu tree may have just been the one that I am looking for.
Gregory
Mark from carrelage imitation parquetÂ






