Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi guys!
Running into a small snag and wondering if you both might help clarify. I want to add a navbar region to basic so I can put the navigation(primary links) into. Is this possible? In the blocks section, there is only the header section to put those links into. I know you can add the region in the .info file, which I have done. region[navbar] = navigation. How should I call it in the page.tpl.php file? I basically want the primary links to be laid out as a horizontal nav bar. Do you both recommend another way to do this?
thanks in advance!
Lance
Comments
Comment #1
lance1572 CreditAttribution: lance1572 commentedSorry! To clarify, I have the div layout on the front end to be as such(just a minor edit to the basic theme -adding the sub-header):
Header
Sub-Header
Navigation
Content
Sidebar
Footer
In the blocks region, at this point, the only logical option is to put them into the header region. or am I completely misunderstanding how to add primary links...
By the way, love the theme. Very easy to get in an edit!
thanks!
Comment #2
lance1572 CreditAttribution: lance1572 commentedThought I fixed it but didn't take.
Comment #3
SteveK CreditAttribution: SteveK commentedYou're about half-way there :)
You can output the "navbar" region that you just created in page.tpl.php by calling it with PHP.
<?php echo $navbar; ?>
This will output the block region in whatever location you put it in.
Comment #4
lance1572 CreditAttribution: lance1572 commentedthanks for your help SteveK! So I wouldn't really need the php condition that's in there now? Specifically, the php if(!empty...) navigation code.
if (!empty($primary_links) or !empty($secondary_links)):
if (!empty($primary_links)){ print theme('links', $primary_links, array('id' => 'primary', 'class' => 'links main-menu')); }
if (!empty($secondary_links)){ print theme('links', $secondary_links, array('id' => 'secondary', 'class' => 'links sub-menu')); }
endif;
Thanks!!!! Sorry! Still a newb at PHP
Comment #5
lance1572 CreditAttribution: lance1572 commentedAlright. This seems to be what I'm looking for. I basically put that php variable inside the #div navigation tag. Thank you!!!!!
Comment #6
SteveK CreditAttribution: SteveK commented$primary_links and $secondary_links output the associated menus.
$navbar outputs the block region.
The data outputted from these variables are very different. The code for outputting a block region is simply this:
This includes the conditional statements as well (as requested). Let me know if this works for you.
Comment #7
lance1572 CreditAttribution: lance1572 commentedThis worked. Thank you! I know this issue was a little off topic but thank you so much for your time!!! I've been working with WP and while that is nice. I've been continuing to lean towards Drupal and the community here is awesome!!! Cannot say enough! This will make my project for my client go faster. Oh, and while I like Zen, Basic was exactly what I have been looking for. Thanks all!
Comment #8
SteveK CreditAttribution: SteveK commentedno problem, glad it worked :)
Comment #9
caten8 CreditAttribution: caten8 commentedthis helped me too, thanks guys!