Search code examples
drupaldrupal-6drupal-theming

drupal multi level top navigation


i'm new to drupal, but i have a good knowledge about php, and html/css. I have this drupal site where the primary menu has 2 levels.

In the page.tpl.php of the theme is see this line:

<div class="pr-menu">
  <?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?>
</div>

the $primary_links variable seems to only hold an array with the first level menu items. Now my question is: what is the best way to load the entire primary menu as an unordered list in stead of the first level primary links that are displayed now?


Solution

  • Finally found some kind of solution, after looking a bit trough the existing functions in menu.inc

    For anyone interested, here is the code to put in your theme's page.tpl.php file, instead of the default primary link code:

    <div class="pr-menu">
      <?php print menu_tree('primary-links'); ?>
    </div>
    

    menu_tree() will return the primary menu as a multi level html-list with all the most important properties (first, last, active,...) accessible trough css classes.