Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

Question about "Childen" in sample BlackCandy SideBar.ss template


Reply

3 Posts   395 Views

Avatar
xm

23 November 2012 at 4:05pm Community Member, 3 Posts

Hi

In the BlackCandy theme folder there's an SS called SideBar.ss and the logic in here is killing me. Here it is...
<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.XML</em></span></a>
           <% else %>
                <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle.XML</em></span></a>
            <% end_if %>   
          
             <% if LinkOrSection = section %>
                <% if Children %>
                  <ul class="sub">
                     <li>
                        <ul class="roundWhite">
                           <% control Children %>
                              <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levelb"><span><em>$MenuTitle.XML</em></span></a></li>
                           <% end_control %>
                        </ul>
                     </li>
                  </ul>
                 <% end_if %>
            <% end_if %>
         </li>
         <% end_control %>
      </ul>
-----------------------
Why is it when there is children it stops there? Why wont it dig deep to flesh it out and when it has no children (the else) it looks for other menu items within?

Thanks for your help

Avatar
Willr

2 December 2012 at 5:48pm Forum Moderator, 5511 Posts

Not sure I follow the question, the <% else %> statement is unrelated to the following <% if Children %> (notice the <% end_if %> in between). The top <% if Children %> is used it appears to just add another class.

<% if Children %> will execute if the page currently in scope has children pages (if your pages are 'hidden' in the sitetree they will not be included).

Avatar
xm

4 December 2012 at 3:01pm Community Member, 3 Posts

Hi

Thanks for your reply.

I'm sorry for coming across as incoherent. There is nothing wrong with the code, of course, but the book I am reading uses this as an example and has misleading whitespacing -- making the if statements out of place.

Thanks again,
xm.