Jump to:

23377 Posts in 18296 Topics by 2868 members

General Questions

SilverStripe Forums » General Questions » How To create 2. Layer in the Menu

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1628 Views
  • stooni
    Avatar
    Community Member
    89 Posts

    How To create 2. Layer in the Menu Link to this post

    How to create a second Layer in the Home Menu / Top Menu ca. for Sitemap, Contact, ... how can create with the silverstripe functionality?

    Thanks for help?

    ---Stooni!

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: How To create 2. Layer in the Menu Link to this post

    Not sure exactly what you mean by 2nd layer.

    Do you want like a suckerfish/drop down navigation?

    If so, this code below works for me. Make some minor adjustments to the html as I setup mine to use images for the nav, and thus need some extra code.

    <ul id="nav">
    <% control Menu(1) %>
    <% if Children %>
       <li id="nav-$URLSegment"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div>
       <ul>
    <% control Children %>
       <li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></li>
    <% end_control %>
    </ul>
    </li>
    <% else %>
       <li id="nav-$URLSegment"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div></li>
    <% end_if %>
    <% end_control %>
    </ul>

  • stooni
    Avatar
    Community Member
    89 Posts

    Re: How To create 2. Layer in the Menu Link to this post

    these way show me every 2. Layer in the menu i mean these way see, the attachment!

    Attached Files
  • bunheng
    Avatar
    Community Member
    77 Posts

    Re: How To create 2. Layer in the Menu Link to this post

    Bunheng

    I am having the same trouble, to create additional navigation on my website, it would be helpful if some one can solve this problem.

    Thanks

  • Devlin
    Avatar
    Community Member
    215 Posts

    Re: How To create 2. Layer in the Menu Link to this post

    Well, it's pretty simple.
    Create a new Page, name it something like 'header-menu' and make sure 'Show in Menus' & 'Show in Search' is disabled. Insert all the pages you want in this Page(-Holder).
    After this you go to your template and build a second menu. Something like:

    <% if ChildrenOf(header-menu) %>
    <ul id="header-menu" class="level_1">
       <% control ChildrenOf(header-menu) %>
       <li class="$FirstLast"><a href="$Link" title="$Title">$MenuTitle</a></li>
       <% end_control %>
    </ul>
    <% end_if %>

    1628 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.