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

<if children> Menu(1) must look different


Reply

3 Posts   1076 Views

Avatar
wonnepfropfen

2 June 2012 at 4:24am Community Member, 18 Posts

Hi there

I'm struggeling with the following problem.

Everytime Menu(1) has got children, Menu(1) has to to look different than the other main menu links.

For now my structure looks something like this:

<ul id="Navigation">
<% control Menu(1) %>
   <li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a>
      <% if LinkOrSection = section %>
         <% if Children %>
            <ul id="Sub-Menu">
            <% control Children %>
            <li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a>
            <% if LinkOrSection = section %>
               <% if Children %>
                     <ul id="Subsub-Menu">
                     <% control Children %>
                     <li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a></li>
                     <% end_control %>
                     </ul>
               <% end_if %>
            <% end_if %>
            </li>
            <% end_control %>
            </ul>
         <% end_if %>
      <% end_if %>
   </li>
<% end_control %>
</ul>

Would anyone know how to do it? I hope you understand what I mean. It's hard to explain.

Thanks

Jessi

Avatar
Willr

2 June 2012 at 12:20pm Forum Moderator, 5511 Posts

I'm not sure I follow by has to 'look' different. You can use something like <% if Children %>class="has-children"<% end_if %> to add a class to something if it has children. Read up on the template controls documentation page for all the template controls you can use.

Avatar
wonnepfropfen

3 June 2012 at 1:12am Community Member, 18 Posts

I'm still struggling with this problem. I have tried lot's of stuff, but sometimes the menu disappears and then it appears twice etc. I've also read controls documentation, but still no clue.

Could you please have a look at the attached pic and tell me if this is possible to do. Maybe I can stop trying.