Jump to:

23454 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Nested UL for Navigation

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: 1510 Views
  • Breastfed
    Avatar
    Community Member
    44 Posts

    Nested UL for Navigation Link to this post

    Hello

    i am now looking more than 1 hour for the Solution of a Nested UL as a Navigation.

    The Output Code should look like:

    <ul id="nav" class="dropdown">
    <li><a href="general-questions/editpost/255645#">First Level</a>
    <ul>
    <li><a href="general-questions/editpost/255645#">Second Level</a></li>
    </ul>
    </li>
    </ul>

    My SS Code is the following:

       <!-- begin: menu -->
    <ul id="nav" class="dropdown">
    <% control Menu(1) %>
          <li class="$LinkingMode"><a href="$Link" title="Go to the "{$Title}" page">$MenuTitle</a>
          <% if Menu(2) %>
             <ul>
           <% control Menu(2) %>
          <li class="$LinkingMode"><a href="$Link" title="Go to the "{$Title}" page">$MenuTitle</a></li>
           <% end_control %>
             </ul>
          <% end_if %>
    </li>
    <% end_control %>
    </ul>
       <!-- end: menu -->

    Anyone who might help me out?

    Thanks!

  • Breastfed
    Avatar
    Community Member
    44 Posts

    Re: Nested UL for Navigation Link to this post

    Sorry - i just found something with luck i would say

    Anyway i will post the Code for somebody with same Needs.

       <!-- begin: menu -->
    <ul id="nav" class="dropdown">
    <% control Menu(1) %>
          <li class="$LinkingMode"><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a>
          <% if Children %>
             <ul>
           <% control Children %>
          <li class="$LinkingMode secondLevel"><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a></li>
           <% end_control %>
             </ul>
          <% end_if %>
    </li>
    <% end_control %>
    </ul>
       <!-- end: menu -->

    Sorry again!

  • b_carr
    Avatar
    Community Member
    2 Posts

    Re: Nested UL for Navigation Link to this post

    Very handy, I made a minor modification for sites that use separate top and left hand navigation - like ones with the brightside theme. Hope it helps someone!

    <ul class="sidemenu">
    <% control Menu(2) %>

       <li><a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle</a></li>

       <% if Children %>
       <% if LinkOrSection = section %>
       <ul class="sidemenu2">
       <% control Children %>

          <li><a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle</a></li>
          <% if Children %>
          <% if LinkOrSection = section %>
             <ul class="sidemenu3">
             <% control Children %>
             <li><a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle</a></li>
             <% end_control %>
             </ul>
          <% end_if %>
          <% end_if %>
       <% end_control %>
       </ul>
       <% end_if %>
       <% end_if %>

    <% end_control %>
    </ul>

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