Posted by argo27 on January 31, 2012 at 10:28am
4 followers
Jump to:
| Project: | Zen |
| Version: | 7.x-5.x-dev |
| Component: | PHP/JS code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | header navigation links |
Issue Summary
Hello Im new to drupal and has started to learn customising and creating subthemes using Zen,
I need to move the default Main menu navigation links (inside the header region and want to style it to float on the upper right portion of it).
I have tried putting this code inside the header region from page.tpl.php file but didnt work
I hope somebody would enlightened me :) thanks
<div id="page-wrapper"><div id="page">
<div id="header"><div class="section clearfix<?php if ($main_menu || $page['navigation']) { print ' with-navigation'; } ?>">
<?php if ($logo): ?>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo"><img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" /></a>
<?php endif; ?>
Comments
#1
First off, that’s not the main menu code in it’s entirety as it appears in page.tpl. Also, you could test if the $secondary_menu might work for your needs, as it is already in the header. If positioning that is an issue, you could also make a new region above header for a custom menu.
BTW, the 7.x-3.x branch is the release version. 7.x-5.x-dev is more of a moving target, and it looks like you’re already working with an older version of page.tpl (if in fact you are writing about 7.x-5).
#2
Working with menus from within the page.tpl is a major PITA. Which is why I wrote the Menu Block module. http://drupal.org/project/menu_block
I think you'll find configuring a Menu Block and placing it in one of your sub-theme's regions much easier than trying to deal with the $main_menu variable in page.tpl. I have plans to remove those menu variables in Drupal 8.
I think we need a code comment in page.tpl to steer people clear of those variables.
#3
I added a lengthy note about this just before
print theme('links__system_main_menu'in the page.tpl.php.http://drupalcode.org/project/zen.git/commitdiff/a834407
#4
Automatically closed -- issue fixed for 2 weeks with no activity.