Jump to:

1367 Posts in 487 Topics by 521 members

Themes

SilverStripe Forums » Themes » Problem with interlocking menu

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 995 Views
  • Nauri2009
    Avatar
    Community Member
    1 Post

    Problem with interlocking menu Link to this post

    Hello! I have a problem. I am still a considerable beginner in the Silverstripe. (And, unfortunately, my English is very bad ...) for a project I need an interlocking menu with 4 levels. Unfortunately, only does not function. Can somebody check my code after mistake? Please, help me!

    Thanks.

    P.S. My code:

    <ul id="Menu2">
              <% control Menu(2) %>
              <% if Children %>
                  <li class="$LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
               <% else %>
                    <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
                <% end_if %>   
                   <% control Children %>
                      <% if LinkOrSection = section %>
                         <% if Children %>
                            <ul class="sub">
                               <li class="$LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
                                  <% 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 %>
                                </li>
                            </ul>
                          <% end_if %>
                      <% end_if %>
                   <% end_control %>
             </li>
             <% end_control %>
          </ul>

    Attached Files
  • Pigeon
    Avatar
    Community Member
    243 Posts

    Re: Problem with interlocking menu Link to this post

    I havent looked at this in great detail, but one think i notice immediately is that you check if children exist, but then execute the Children control regardless of the check... So, maybe try:

    <ul id="Menu2">
       <% control Menu(2) %>
          <% if Children %>
             <li class="$LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
          <% control Children %>
             <% if LinkOrSection = section %>
                <% if Children %>
                   <ul class="sub">
                      <li class="$LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
                         <% 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 %>
                      </li>
                   </ul>
                <% end_if %>
             <% end_if %>
          <% end_control %>
          <% else %>
             <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
          <% end_if %>
       </li>
       <% end_control %>
    </ul>

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