Display children of the actual menu node (Not all the menu tree)

Last modified: November 16, 2006 - 00:51

In our web (http://www.fundacionalzheimur.org/formacion) we use the structure of the menu primary links, but we haven't found an automatic way of present, as in a book, the child nodes when displaying a menú node.

Our solution is including this php snippet in the node.tpl template, just before the content, in a div floating right:

.... <div class="itemtext">
<!-- Expanded Menu for navigation -->
<?php
$mid
= menu_get_active_nontask_item();
 
$active = menu_get_item($mid);
 
// this is a top-level link in your primary links
 
if($active['pid'] == variable_get('menu_primary_menu', 0)){
   
$output.= theme('menu_tree',$mid);
        print(
'<div id="menubox"><h2>navigate</h2>');
    print
$output;
    print(
'</div>');
  }

?>

<!-- end of menu  -->
    <?php print $content?>
  </div> .....

The CSS would be:
#menubox {
  display: block;
  float:right;
  width: 35%;
  margin-left: 18px;
  margin-bottom: 18px;
  padding-bottom: 5px;
  background: #fff url(images/Fondo_Logo_menu.jpg) no-repeat bottom right;
}
#menubox h2 {
background: #fff  url(images/block-quote_left.gif) no-repeat top left;
color: #6A0D22;
padding: 7px 7px 7px 37px;
margin-bottom: 2px;
line-height: 0.6em;
}

See module submenutree

bengtan - November 12, 2007 - 04:46

While surfing, I came across this (apparently) old page. If you have a Drupal 5.x site, you may be interested in submenutree.

 
 

Drupal is a registered trademark of Dries Buytaert.