Reputation: 455
I'm trying to build a menu which shows the level 1 menu and also the level 2 menu on the same navigation bar. This is because all the children of Page 1 need to be in the top level menu. I can easily do this by looping menu(2) in the nav, but this only shows those pages if you are on the parent page.
<% loop $Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle.XML</a></li>
<% end_loop %>
<% loop $Menu(1) %>
<li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle.XML</a></li>
<% end_loop %>
Upvotes: 0
Views: 514
Reputation: 365
You can loop the children of a menu using $Children
If you just want the entire list of all the child pages, you can loop the menu1 and just not render that out, and return just the children:
<% loop $Menu(1) %>
<% loop $Children %>
<li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle.XML</a></li>
<% end_loop %>
<% end_loop %>
If you want them in the li of each you can add them similarly there:
<% loop $Menu(1) %>
<li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle.XML</a>
<% if $Children %>
<ul>
<% loop $Children %>
<li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle.XML</a></li>
<% end_loop %>
</ul>
<% end_if %>
</li>
<% end_loop %>
Upvotes: 5