Greetings theming wizards!
I am working on a site with a complex menu structure. Currently I have just primary and secondary links (both sourcing from primary, so that secondary displays children of primary menu). I have another menu that I want to add that does not need to relate to the other too in terms of primary and secondary as it will be static and appear on everypage. However I want my php to output this menu before any of the others so I can justify it to the right and float the primary menu in it's margin. I've never had a great understanding of the menuing system. Can I just insert
above the primary menu and if so how do I get it to see that as a links menu do I have to edit the menu.inc file?
Any help would be greatfully appreciated.
If its any help I saw the technique used very well on this site, but can't quite workout how they did it.
http://www.rsh-p.com
Many, many thanks for any advice,
Durruti
Comments
tricks
Trick is to first create the menu and then store it in a variable, then as you suggest print the variable in page.tpl.php.
So, in template.php - in your case in your Zen subthemes template.php file;
To get the right machine name for your menu (to replace "menu-name-of-menu") go to admin/build/menu/list and hover over the link to your new menu, you will see it as the last bit of the URL in the status bar.
Then in page.tpl.php you'll probably want to do something like;
Works with any Drupal 6 theme - just use function theme_preprocess_page(). Follow the same procedure using the subthemes template.php if you are using a similar starter-theme such as Genesis.
ref: http://api.drupal.org/api/function/menu_navigation_links
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
Thanks! Can I safely remove the 'if' clause?
Thanks, jmburnz your a star as always!
However having entered the code the menu doesn't show up on the site (and I can find no mention of it using firebug), as it's not selected to appear anywhere. I want the menu to appear on every page and selecting the menu to appear as a block doesn't fulfil my needs (in that it appears after the primary and secondary) and I don't want to go near the menu.inc. Am I OK to remove the php 'if' clause to leave;
<div id="newmenu"><?php print $new_menu; ?></div>It works for me at the moment, but am I missing a more 'correct' way of doing things?
Many thanks again for all your help.
Durruti
...
Yes, you can remove the "if", but I would think there is an error with "if" statement if its not showing with the "if", but is showing without - the two variables must be identical.
BTW - you welcome.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.