2

I have the following menu structure which i like to implement in Drupal 7 :

<ul id="dropdown-menu" class="fixed">
    <li><a href="index.html">Home</a></li>
    <li><a href="about.html">About</a>
        <ul class="sub-menu">
            <li><a href="about.html">About Us</a></li>
            <li><a href="team.html">Team</a></li>
        </ul>
    </li>
</ul>

So far i have the base elements displaying correctly using :

<?php 
print theme('links__system_main_menu', 
array('links' => $main_menu, 'attributes' => array('id' => 'dropdown-menu', 
'class' => array('fixed')))); 
?>

Problems :

  • It doesn't display nested elements
  • I can only control the styling of the first level but in my code i have to apply a subclass of 'sub-menu' according to my theme.

Can someone point me to a starting point ? Thanks

1
  • Exactly in the same boat as you. Starting to annoy me, real bad. Unfortunately your question didnt get an answer. Commented Mar 2, 2012 at 16:38

1 Answer 1

2

As far as I know, it's not possible to make theme('links__system_main_menu' [...]) display the nested elements. That suprised me, too...

One way to fix this: set up a region in the theme for the menu and put a menu block in there. This will display the nested elements, however styling the menu itself won't be much easier than before. theme_menu_tree() and theme_menu_link() hooks could be useful.

Also, check out the Menu block module.

p.s. I'm currently doing something similar that you do and it seems to be quite complicated for me, too, so I just summarized what I've already found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.