Jump to:

1347 Posts in 439 Topics by 514 members

Themes

SilverStripe Forums » Themes » Dynamic Second-level menus

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1704 Views
  • zEkE
    Avatar
    Community Member
    1 Post

    Dynamic Second-level menus Link to this post

    I don't often ask for help, but this one is baffling me a little.. I'm working on a website in SS, the client wants a multilevel arrangement (easy!) but wants the second levels to be available to the user when rolling the mouse over the first level (not so much..).

    <ul class="Menu1">
    <% control Menu(1) %>
    <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode">$MenuTitle</a></li>
    <% end_control %>
    </ul>
    <% if Menu(2) %>
    <ul class="Menu2">
    <% control Menu(2) %>
    <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode">$MenuTitle</a></li>
    <% end_control %>
    </ul>
    <% end_if %>

    So far I just have the above, and it works, but it isn't dynamic based on rollover.

    I'm imagining this is going to require javascript of some level, so it would be nice to retain the above method in the event that a browser doesn't support the javascript.

    To be honest I've never needed to deal with this situation, with or without SilverStripe - could this be done by putting the second-level hierarchy in a DIV and having an onMouseOver script replace the contents of it with another 2nd level menu? Either way, the problem at this point is gleaning the information for the secondary menus in such a way as I can present it in the way I need it..

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Dynamic Second-level menus Link to this post

    Menu(2) will return the Current Pages menu, not the currently controlled objects menu 2. You should use <% control Children %> to individually get the children pages of each of the menu 1 items.

    1704 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.