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

Level 2 menu control with isCurrent


Reply

3 Posts   3536 Views

Avatar
Bambii7

19 March 2009 at 12:25pm Community Member, 254 Posts

HI all,
I'm getting there slowly, but really slowly. I'm begging to understand templates and sitetree a little more. I'm am having major trouble with setting up a permanent sub menu, a question I see a few others asking with a few different solutions.

I've got ye old main menu running horizontally along the header. And a sub menu running down the side with all the children of home to appear on all pages. So far so good. Now I'm having trouble identifying the current active menu to then display a third level menu. The boolean isCrruent gives me errors :( can you even use this in an <% if isCrruent %> statement?

the code

<ul id="nav">
   <% control Menu(2) %>
      <% if Children %>
          <li id="nav"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div>
          <ul>
               <% control Children %>
                <li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></li>
               <% end_control %>
            </ul>
            </li>
      <% else %>
       <li id="nav"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div></li>
      <% end_if %>
   <% end_control %>
</ul>

I was trying to do the following but my noobness got me stumped

<ul id="nav">
   <% control Menu(2) %>
      <% if Children %>
<% if isCurrent %>
          <li id="nav"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div>
          <ul>
               <% control Children %>
                <li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></li>
               <% end_control %>
            </ul>
            </li>
<% end_if %>
      <% else %>
       <li id="nav"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div></li>
      <% end_if %>
   <% end_control %>
</ul>   

Any ideas? I've been working on this for an embarrassing long amount of time. I was originally trying use the sitemap() function form the tutorial. Then realised the default controls should be capable of managing this.

Avatar
Bambii7

19 March 2009 at 12:57pm Community Member, 254 Posts

OK am I correct in thinking this will work?
<% if LinkingMode = current %>

Avatar
Bambii7

20 March 2009 at 10:19am Community Member, 254 Posts

Sorry to be self posting, here is where I got to yesterday. Lernt a whole bunch but still haven't managed to get it on every page. I'm assuming I'll have to build some sort of page controler?

<ul id="menutwo">
<% control Menu(2) %>
<% if LinkingMode = current %>
<li class="navlvl1 $LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>
<% control Children %>
<li class="navlvl2 $LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>
<% end_control %>
<% else_if LinkingMode = section %>
<li class="navlvl1 $LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>
<% control Children %>
<li class="navlvl2 $LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>
<% if LinkingMode = current %>
<% control Children %>
<li class="navlvl3 $LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>
<% end_control %>
<% else_if LinkingMode = section %>
<% control Children %>
<li class="navlvl3 $LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>
<% end_control %>
<% end_if %>
<% end_control %>
<% else %>
<li class="navlvl1 $LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>
<% end_if %>
<% end_control %>
</ul>