Simple book-like navigation using menu items

Last modified: July 25, 2007 - 04:19

If your users aren't going to look at the Navigation menu to choose child pages, use this in a block in the content space to give a short book-like navigation menu.

Don't add a title to the block: if there are no children for the current page, nothing appears at all.

<?php
$shortmenu
= menu_get_menu();

if((
arg(0) == 'node') && (is_numeric(arg(1)))) {
 
$curpath = 'node/'. arg(1);
 
$menuid = $shortmenu['path index'][$curpath];
 
// print "<p>Node index: $curpath , $menuid</p>";
 
print theme('menu_tree', $menuid);
}
?>

 
 

Drupal is a registered trademark of Dries Buytaert.