Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » How to do a "Main Menu" with childrens

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1028 Views
  • Axl Rose
    Avatar
    Community Member
    7 Posts

    How to do a "Main Menu" with childrens Link to this post

    I'am modifing the BlackCandy template, and I want to have a sidebar with ALL sections (home, information, photos, ecc) in every section (not just sidebar "about us" on "about us" section). Something like this:

    Home
    Information
    -History
    -Biography
    Photos
    -Axl
    -Slash
    Contact

    I can do that, but when I have a 3rd level (for example, Information->Biography->Axl) it doesn't show (It should be shown only when someone clicks on "Biography").

    EDIT: I've just got it. Here's the code:

    <div id="Sidebar" class="typography">
       <div class="sidebarBox">
        <% control Menu(1) %>
           <h3>
             <% control Level(1) %>
                $Title
             <% end_control %>
          </h3>
           <% if Children %>   
           <% if Children %>
           <ul id="Menu2">
           <% control Children %>
           <li class="$LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a></li>
           <% if LinkOrSection = section %>
                    <% if Children %>
                      <ul class="sub">
                         <li>
                             <ul>
                                <span class="roundWhite">
                                <% control Children %>
                                    <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levelb"><span><em>$MenuTitle</em></span></a></li>
                                <% end_control %>
                                </span>
                              </ul>
                           </li>
                       </ul>
                     <% end_if %>
                <% end_if %>
              <% end_control %>
           <li></li>
           </ul>
           <% end_if %>
           <% end_if %>
        <% end_control %>
       </div>
    </div>

  • Phalkunz
    Avatar
    69 Posts

    Re: How to do a "Main Menu" with childrens Link to this post

    It should be like the following.

    <% control Menu(1) %>
       $Title<br/>
       
       <% control Children %>
       
          --- $Title <br/>
          
          <% control Children %>
             ------ $Title <br/>
          <% end_control %>
          
       <% end_control %>
       
    <% end_control %>

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