Display a menu or part of it

Last modified: August 23, 2006 - 14:27

This is useful in cases when you want to display only part of the menu tree (e.g. sub-tree), or may be apply some pre-processing to the menu, or add some php or text before the menu itself.

First, you have to take note of the menu's mid, this can done from admin/menu, move over the "edit" link for your menu item, then in your browser's status bar there should be something like: http://example.com/admin/menu/item/edit/19, the latest argument is the mid, which is 19 in this example.

And here comes the php code:

<?php
$mid
= 19;
print
theme('menu_tree', $mid);
?>

 
 

Drupal is a registered trademark of Dries Buytaert.