开发者

Drupal menu with submenus only shows submenu of current page. NOT a CSS problem

This is not a CSS problem. The HTML isn't there. I need the menu, with submenus to exist in HTML on EACH page. Right now, the submenu only exists in HTML for the submenu related to the page being currently viewed. Here's an example of what it SHOULD be like.

<ul id="menu">
    <li>Page1
        <ul class="sub">
            <li>sub1.1</li>
            <li>sub1.2</li>
            <li>sub1.3</li>
            <li>sub1.4</li>
        </ul>
    </li>
    <li>Page2
        <ul class="sub">
            <li>sub2.1</li>
            <li>sub2.2</li>
            <li>sub2.3</li>
            <li>sub2.4</li>
        </ul>
    </li>
    <li>Page3
        <ul class="sub">
            <li>sub3.1</li>
            <li>sub3.2</li>
            <li>sub3.3</li>
            <li>sub3.4</li>
        </ul>
    </li>
</ul>

But here is what is actually happening (say I'm currently viewing Page2):

<ul id="menu">
    <li>Page1</li>
    <li>Page2
        <ul class="sub">
            <li>sub2.1</li>
            <li>sub2.2</li>
            <li>sub2.3</li>
            <li>sub2.4</li>
        </ul>
    </li>
    <li>Page3</li>
</ul>

Additionally, and maybe this doesn't have anything to do with it, but whichever list item <li> element is relative to the page i am currently on is given these classes expanded active-trail and any other <li> is given collapsed class.

The classes aren't really so much of an issue, the problem is just that the content (html) isn't there.

Does anyone have any idea what's going on here. I feel like I've been digging in the Drupal Admin menus forever now. I feel like it's got to have a PHP solution 开发者_开发百科in the template file or something, but I don't know Drupal super well at this point.

Thank you!


I believe you can set it to be expanded in the Menu Administration page.

  1. Head to the page (Administer › Site building › Menus , or http://[drupal address]/admin/build/menu).
  2. Choose the Menu you want to work on (you can try it out on the Navigation menu).
  3. In check the checkboxes under Expanded for the submenus that you want to appear expanded. (In your example above, Page 1, Page 2, Page 3 should all have their Expanded checkbox checked, not the sub-items)
  4. Save the configuration.

That's it. :)


This depends on the theme you are using, some themes may require some modifications before they allow this. If it does there should be an option along the lines of "if selected and this menu item has children, the menu will always appear expanded" to tick.

Another issue could be that you need to put the primary links in to a block instead of letting the template handle it.

This page describes a change you can do to a theme: http://drupal.org/taxonomy/term/6348

Hope something of this can be of use. This was intended to be a comment but since I'm not allowed to comment I put it in an answer (please forgive me :<).


What you got is standard Drupal behavior. It's based on the secondary menu being static instead of a menu that can be expanded.

There are different modules that fix this problem. You might need to do some work if you need to make a trail etc. I would recommend nice menus I've had good experience using this module which creates the menu as a block.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜