Like the title says, what code do I use to call a menu that I have created in Admin>Site Building>Menus into my theme .tpl.php.

Thanks.

Comments

cog.rusty’s picture

What do you mean "call a menu"? Can you explain what that should do?

nevets’s picture

The "easy" way is to add the block holding the menu to a region.

phpsharma’s picture

try using $secondary_links and $_primary_links

loop through these arrays and work on it.

sharma chelluri

deathgod’s picture

By calling a menu, I mean just placing a custom menu/block anywhere when I stick some kind of placeholder code. The header/footer/sidebars are a bit too restrictive and I'd like to position my menu in an exact spot. Also could you elaborate a little sharma, I'm a little new to this and a little lost :P

dman’s picture

The best practice way (seeing as you are modifying your page.tpl.php anyway) is to declare a new region where you want it, then place the menu block in that region. Good fun.

Beyond that, if you understand the implications of doing unsupported code, you can invoke

print(menu_tree(7));

where '7' is the menu ID you want. Or something like that.

http://api.drupal.org/api/function/menu_tree/6

.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |

deathgod’s picture

Okie thx dman, I'll go with the declaring the region way of things.

Thanks to all for the help.

cog.rusty’s picture

Notice that those instructions for regions are only for Drupal 6. There is a note about Drupal 5, and you will have to look up the documentation for that.