We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36686
    • 165 Posts
    I have 3 levels of navigation, and I want the sub level(s) to be shown only for the section(s) you’re currently in. Pretty much a standard three level nav in other words.

    It’s not a problem getting the first and second levels to display as I want them to, but I’ve tried every possible combination to get the third level to appear correctly, and searched the forum, without any luck. The closest I’ve come is this, which displays the correct nav when you’re on a second level page, but when on a top level page the third level nav is also shown (with the the 2nd level nav in it) which I don’t want.

    <!-- Topnav -->
    	<div id="topnav">[[Wayfinder? &startId=`0` &level=`1`]]</div> 
    <!-- Second level nav -->
    	[[!Wayfinder? &startId=`[[UltimateParent? &topLevel=`1`]]` &level=`1` &outerTpl=`subnavOuter`]]
    <!-- Third level nav -->
    	[[!Wayfinder? &startId=`[[UltimateParent? &topLevel=`3`]]` &level=`1` &outerTpl=`subsubnavOuter`]]


    subnavOuter:

    <ul id="subnav"[+wf.classes+]>
    	[[+wf.wrapper]]
    </ul>


    subsubnavOuter:

    <ul id="subsubnav"[+wf.classes+]>
    	[[+wf.wrapper]]
    </ul>


    What am I doing wrong here?
      • 36686
      • 165 Posts
      I had to solve this with a template variable and an output filter in the end. It’s not perfect, because the site manager now has to select Yes on the pages that need 3rd level navs, and I’d prefer if it was done automatically like the 2nd level. So, if someone has a better solution you’re more than welcome with a suggestion.

      	[[*submenu:is=`Yes`:then=`[[!Wayfinder? &startId=`[[UltimateParent? &topLevel=`3`]]` &level=`1` &outerTpl=`subsubnavOuter`]]`]]
        • 17667
        • 108 Posts
        Sounds like you are trying something similar to what I am working on. I set up this code to show the navigation at the second or third level. If a document is fourth level or higher it is still only the third level that shows:

        [[Wayfinder:ifempty=`
        
        [[Wayfinder?
        	&startId=`[[UltimateParent? &topLevel=`2`]]`
        	&level=`1`
        	&outerTpl=`subnavOuter`
        ]]
        
        
        `?
        	&startId=`[[UltimateParent? &topLevel=`3`]]`
        	&level=`1`
        	&outerTpl=`subsubnavOuter`
        ]]
        


        May not be exactly what you are looking for but it might give you a direction to go in.
          • 37143
          • 74 Posts
          maybe try having the third level menu output as usual on the top level pages, and use Jquery to hide them? Just a suggestion...
            • 37143
            • 74 Posts
            just a follow up, I used the If snippet and passed it an array of values to compare the parent against. This might be useful if your main sections of your site are not changing all that much.

            [[If?
            &subject=`[[*parent]]`
            &operator=`inarray`
            &operand=`1,2,list IDs here etc.`
            &then=``
            &else=`[[$third-level-menul]]`
            ]]