Can anyone point me at a simple example of a module that creates a menu inside a block? Just a heading with a couple of menu items underneath it, written in such a way that it follows the theme (I'm using phptemplate).

I've read the documentation but it won't quite gel. I tried looking at the menu.module code and got more confused than ever. A simple example I can build on would help a lot.

Comments

Folkert’s picture

Well if you mean you want a menu form a certain menu-item you could create a new block 'admin/block/add' and insert a piece of code like:

if ($menu = theme_menu_tree(29)) {
   $menu = "<div class=\"menu\">". $menu . "</div>";
   return $menu;
}
else {return;}

where the number of the menu you want is found in admin/menu/item/edit

luck,

Folkert

nevets’s picture

You can use the menu module to create new menus the enable the block(s) as needed.

Folkert’s picture

If your menu is like 'home'->'headItem'->subItem you could simply make a menu, for let's say 'headItem', like i wrote in the last reply.

For a site wide menu you are right. just enable the block.

thrice’s picture

I need to write a module that picks up items from a database and shows different menu items to different users based on certain criteria found in my business logic.

I'm asking for a simple example of how to build a menu, not because I need to do something simple, but because I need to understand how to do it!

johnalbin’s picture

Can’t get any simpler than the way menu module builds a menu block: http://api.drupal.org/api/function/menu_block/6

Here's a more complex example (no Drupal 6 port yet): http://drupal.org/project/menu_block

Wow, are you really using Drupal 4.6? Blargh. Not sure how I found such an old post. :-p

  - John (JohnAlbin)

  - John (JohnAlbin)