By msteudel on
Ok i've done some searching and I think I understand how to do this, but I'm getting an empty array when I try and print out my custom menu.
Steps:
1. Went into the admin and created a new menu called Login_logout (it's pid is 99, i got that by hovering over it's edit link: http://domain.org/admin/build/menu/menu/edit/99 )
2. Added two menu items (Login and Logout)
3. Went into my page.tpl.php and added the following code
$pid = 99; // This would be the menu id of one of your new menus.
$menu = menu_primary_links(1, $pid);
print_r( $menu ); // <-- this prints an empty array
print theme('links', $menu, array('class' => 'some_class')); // <-- this prints nothing
Any thoughts to what I'm doing wrong?
TIA
Comments
code worked fine
Hi msteudel, I copied and pasted your exact code just to reproduce your situation (only changing the pid) and it worked fine on my d5 install.
--
Shawn Gregg
www.shalosophy.com - blog
www.gmndesign.com - portfolio
Thanks for checking! That
Thanks for checking! That helps me at least narrow things down.
MS
Argh! Why does this stuff
Argh! Why does this stuff only work in 5.x and not 6.x?
http://drupal.org/node/403934
Output of custom menu entrys
Though a very newbie to D6 I found this to work ..just needs styling up using a class:
where :
"menu-myname" is the D6 name of the menu [ not a node or menu ID :-) ]
0 at the end of the call to menu_navigation_links is the default level, I suppose if you want to descend further you can (I didn't).
and "my-class" is the style to apply to the output.
Need tweaking.
This code didn't quite work for me so i replaced
theme('links')withtheme_links().Works in D6.20
Tutorial
Hi all,
i've put together a tutorial on custom menus. I hope it helps a few people.
http://www.kleinermann.com.au/blog/add-a-custom-menu-in-drupal-6/
kleinermann web design