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!



lance1572’s picture

Sorry! 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):


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!

lance1572’s picture

Thought I fixed it but didn't take.

SteveK’s picture

You'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.

lance1572’s picture

thanks 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)):


Thanks!!!! Sorry! Still a newb at PHP

lance1572’s picture

Alright. This seems to be what I'm looking for. I basically put that php variable inside the #div navigation tag. Thank you!!!!!

SteveK’s picture

$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:

<?php if($navbar): ?>
  <div id="navigation-region">
    <?php echo $navbar; ?> <!-- This is the important part! -->
<?php endif; ?>

This includes the conditional statements as well (as requested). Let me know if this works for you.

lance1572’s picture

This 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!

SteveK’s picture

Status: Active » Closed (fixed)

no problem, glad it worked :)

caten8’s picture

this helped me too, thanks guys!