Drupal 5: Inserting a menu anywhere (block, page, module, etc)

When you create a menu, a block is automatically generated for you. Blocks can only be assigned to one region at a time. In some cases, you might want to have the same menu appear in your site in different places. This can be accomplished using the menu_tree function. This function accepts one argument, the parent ID of the menu. This ID can be found at admin/build/menu. If you mouseover the edit link of the menu you’d like to insert, you’ll see the following URL structure: admin/build/menu/menu/edit/### (where ### represents the parent menu ID). You can now generate a menu using the following code:

<?php
print menu_tree('YOURMENUID');
?>

If you’re having a hard time finding a menu ID, you could query the menu table [see below]. You’ll be interested in the “pid” column (not the “mid” column, which is the unique identifier).

select * from {menu}

If you’d like to also show the menu’s title, you could use menu_get_item to look it up:

<?php
$menuID = 77;
$menuItem = menu_get_item($menuID);
if ($menuItem) {
  print "<h3>" . $menuItem['title'] . "</h3>";
  print menu_tree($menuID);
}
?>

Updated: