I've been using the B7 theme for over a year now and it's worked great except for I've never been able to get the Primary menu to work. When I activate it, all that appears in the Primary menu is "| Array | Array |" etc.

Here's the code in the page.tpl.php file for the B7 theme:

  <div id="top-nav">
   <?php if (is_array($primary_links) && count($primary_links) != 0) : ?>
    <ul id="primary">
     <?php foreach ($primary_links as $link): ?>
      <li> <?php print $link?> </li>
     <?php endforeach; ?>
    </ul>
   <?php endif; ?>
   <?php if (is_array($secondary_links) && count($secondary_links) != 0) : ?>
    <ul id="secondary">
     <?php foreach ($secondary_links as $link): ?>
      <li> <?php print $link?> </li>
     <?php endforeach; ?>
    </ul>
   <?php endif; ?>
  </div>
  <?php if($header) : ?>
    <div class="sidebar" id="sidebar-top">
      <?php print $header; ?>
    </div>
  <?php endif; ?>

I don't see why it's not showing this menu. I'd love to use the Primary Menu feature for my website but can't seem to find a way to fix this problem. Any ideas?

Comments

artist.lupein’s picture

$link in the foreach is actually an array and that's why you get "| Array | Array |" etc. You need to theme the links in order to show them.

I guess that you are actually using 4.6 or 4.7 version of theme on Drupal 5.x. If so and you do not have important modifications you want to preserve, go and install 5.x version of theme.

If you prefer to fix what you have, fast way to do it is to put something like

    <?php print theme('links', $primary_links, array('class' => 'links primary')) ?>

instead of

    <ul id="primary">
     <?php foreach ($primary_links as $link): ?>
      <li> <?php print $link?> </li>
     <?php endforeach; ?>
    </ul>

Same fix goes for secondary links.

--
Lupein
Drupal themes - themeartists.com

Chichee’s picture

I don't know why I didn't think of that but than you, artist.lupein, for making me do it. This fixed the problem. I now have happy little primary links on my website!