Jump to:

22976 Posts in 11702 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Showing sister, brother OR children 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: 1562 Views
  • sca123
    Avatar
    Community Member
    61 Posts

    Showing sister, brother OR children menu Link to this post

    Hi

    I would like to be able to have a control that will display either all second level menu items under the selected parent OR all second level menu items that are sister/brother to a selected second level menu.

    Any assistance would be appreciated.

  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    Re: Showing sister, brother OR children menu Link to this post

    Sca123,

    I had the exact same issue when I first started. It's hard to get your head around how SS does the nav, but after you get it, you'll see how smart the people where at SS.

    Instead of explaining I'm just going to give you my code and you can see it in action at: http://www.radimage.com

    Note: I only go 3 levels deep on the menu. Also, I made the sidebar as an includes in the templates.

    Hope this helps and is what you are looking for.

    Terry

    <CODE>

    <div id="Sidebar" class="typography">
       <div class="sidebarBox">
          
          
    <ul id="menu">
       <% control Menu(1) %> <!-- Level I -->
          
           <li class="m$ID $LinkingMode"><a href="$Link" target="_self" class="a$ID">$MenuTitle.XML</a></li>

        <!-- for expanding out the first menu -->
           
             
        <% if URLSegment = rit113-imrt-qa-software %>
       <% if LinkingMode = link %>
             <% control Children %>
                <ul id="smenu">
                   <li class="m$ID $LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="sa$ID">$MenuTitle</a></li>
                </ul>
             <% end_control %>      
          <% end_if %>
       <% end_if %>
          <!-- end for expanding out first set of menu items -->   
             
                
             <% if LinkOrSection = section %>
             
                <% if Children %>
                   <% control Children %>
                      <ul id="smenu">
                         <li class="sm$ID $LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="sa$ID">$MenuTitle</a></li>
                            <% if LinkOrSection = section %>
                            <% if Children %>
                               <ul id="ssmenu">                               
                                  <% control Children %>
                                   <li class="ssm$ID $LinkingMode"><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></li>    
                                  <% end_control %>                                  
                               </ul>   
                             <% end_if %>
                            <% end_if %>
                      </ul>
                   <% end_control %>    
                <% end_if %>
             <% end_if %>            
       <% end_control %>
    </ul>

       
       </div>
       

    </div>

    </CODE>

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