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

Issue with menu levels


3 Posts   1976 Views


11 July 2009 at 12:05pm Community Member, 42 Posts


I have the following code in a Includes/ file:

   <% control Menu(1) %>   
      <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.XML</span></a></li>

      <% if Menu(2) %>
      <ul id="Menu2">
          <% control Menu(2) %>
            <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.XML</span></a></li>

         <% end_control %>
      <% end_if %>

   <% end_control %>

And the simply does a: <% include Navigation %>

My problem is that the list output from is not including the second level (i.e. Menu(2) ). However, there is a menu(2) existing for one of the top level menu items, and this is correctly outputted on that item's page (e.g. when I click that page - as in Layout/ there is output code similar to above to show the Menu(2) items and breadcrumbs etc.)

So basically, it will find/output menu(2) only when the page that actually has a menu(2) component is "active" - and not just on the homepage for example.

What could be going wrong here?



11 July 2009 at 3:45pm Forum Moderator, 5511 Posts

Menu(2) returns the menu for the current page, not the page within the loop.

Instead of doing the <% control Menu(2) %> inside the <% control Menu(1) %> you need to do <% control Children %> instead. To make sure the 2nd level is only shown when you are on that parent page or a child page of that you can wrap the <% control Children %> in a <% if LinkOrSection = section %> which will return true if you are on that page or a child of that page


14 July 2009 at 3:28pm Community Member, 42 Posts

Thanks for the help will! :)