Back when I used 4.7 I had no problem converting my primary links into a unordered list. Now in 5.0 however, I can't get this to work.

So back in the 4.7 days I did something like this:

<?php
print '<ul>';
foreach ($primary_links as $link) {
   print '<li>'. $link .'</li>';
}
print '</ul>';
?>

And your primary links are all set to be in a unordered list with additional

  • and sub
  • Comments

    morphir’s picture

    this got ugly, sorry.

    But, when I have my primary links displayed as this unordered list example in my previous post, then I can applie some css code that makes this a quite beautiful menu.

    Like in the example menus presented here: http://www.cssplay.co.uk/menus/drop_examples.html

    So anyone who can point me in the right direction here would be a saint! ;)

    morphir.com

    teshager’s picture

    I thought I saw a module a while back "advanced_menu" or something like that that did what you're looking. I would search for "menu" in the projects list and am sure you will find it.

    Have fun.
    /c4rider

    nevets’s picture

    Changing

    <?php
    print theme('links', $primary_links);
    ?>
    

    to

    <?php
    print theme('menu_tree', $primary_links);
    ?>
    

    should give you your unorder list.

    morphir’s picture

    thank you nevets!

    It does give me a unordered list, but not expanded(not children of the links). You got that one covered as well?

    At least now I'am one the right track here :)

    morphir.com

    morphir’s picture

    My original theme function looks like this:

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

    To get the ul-listing AND expanded, I did:

       <?php 
         print theme('menu_tree',variable_get('menu_primary_menu',0)); 
       ?>
    

    However, if you look at the first theme function(the original one) it contains an array that assigns the class
    menu_tree primary_menu. This gives me the class .primary_menu which is easy to work with.

    So the only issue I'am facing now, is how to assign this class to my last theme function.. Care to fill me in?

    morphir.com

    JamesHayton’s picture

    Go take a look at two posts I have made trying to do the same thing...Here are the links...

    http://drupal.org/node/128397

    and

    http://drupal.org/node/132992

    I am working with someone right now who is writing the code to allow me to do almost the exact same thing that you are going to be doing...Check out the posts and see...If thats what you want, get back to me and when I get the code, I can let you know...