We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23372
    • 7 Posts
    for me works the ultimatParrent almost perfectly

    I have three menu’s. top --- left --- submenu

    in the submenu i want to set all the submenus of top and left

    That works great, but when i click on a menu-item in the submenu, the submenu dissapear.

    This is what i’ve got

            <div class="leftmenu">
                      [[Wayfinder? &startId=`3` &level=`1` &hideSubMenus=`true` &outerClass=`nav1`!]]
            </div>
    	<div id="headernav">
    		[[Wayfinder? &startId=`0` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]]
    	</div>
    <div id="headersubnav">
    				[!Wayfinder? &startID=`[[UltimateParent]]` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]
    </div>



    Why does the submenu dissapear when I click on a submenu-item?
      • 14050
      • 788 Posts
      Is that code in the content of the submenu item your are clicking? Is that code in your template, a chunk, a TV? If it is in a TV you will likely want to take advantage of @INHERIT. The more information you provide, the easier it will be for us to help.
        Jesse R.
        Consider trying something new and extraordinary.
        Illinois Wine

        Have you considered donating to MODx lately?
        Donate now. Every contribution helps.
        • 27376
        • 576 Posts
        Try this (made some small changes, look very closely):
                <div class="leftmenu">
                          [[Wayfinder? &startId=`3` &level=`1` &hideSubMenus=`true` &outerClass=`nav1`]]
                </div>
        	<div id="headernav">
        		[[Wayfinder? &startId=`0` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`]]
        	</div>
        <div id="headersubnav">
        				[!Wayfinder? &startId=`[[UltimateParent]]` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]
        </div>
        Just fixed up some issues I noticed, we’ll see if it fixes your problem though...
          • 23372
          • 7 Posts
          Thanks...but it is almost good.

          When i change the &startID to &startId

          The leftmenu also is vissible in the submenu... I only want to see the submenu over there
            • 7231
            • 4,205 Posts
            I am having a hard time following, if you could somehow illustrate (could be with a document tree) the site structure and what is supposed to show in each menu it may be easier to figure this out.

            If you are trying to get the submenu with ultimateParent you will also need to set the parameter to indicate how many levels to go. The default will take it back to the first parent but for a sub menu you usually need a second or third level menu rather than a top level menu. Maybe try the simple [*parent*] to get the current parent ID.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 23372
              • 7 Posts
              okay i will try to explain it.

              I have a main menu with submenu’s
              topmenu 1
              sub-topmenu1
              sub-topmenu2
              topmenu 2
              sub-topmenu3
              sub-topmenu4
              topmenu 3
              sub-topmenu5
              sub-topmenu6
              this is
              	<div id="headernav">
              		[[Wayfinder? &startId=`0` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`]]
              	</div>
              

              I also have a leftmenu
              leftmenu 1
              sub-leftmenu1
              sub-leftmenu2
              leftmenu 2
              sub-leftmenu1
              sub-leftmenu2
              leftmenu 3
              sub-leftmenu1
              sub-leftmenu2
                      <div class="leftmenu">
                                [[Wayfinder? &startId=`3` &level=`1` &hideSubMenus=`true` &outerClass=`nav1`]]
                      </div>
              


              Both menu works great.
              But I also have a div --- submenu
              <div id="headersubnav">
              				[!Wayfinder? &startId=`[[UltimateParent]]` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]
              </div>
              


              In this <div id="headersubnav"> I want to put the submenu’s of the menu and leftmenu
              so when i click on topmenu1, i’ll see sub-topmenu1 and sub-topmenu2 in the <div id="headersubnav">
              so when i click on topmenu2, i’ll see sub-topmenu3 and sub-topmenu4 in the <div id="headersubnav">
              so when i click on topmenu3, i’ll see sub-topmenu15 and sub-topmenu6 in the <div id="headersubnav">
              so when i click on leftmenu1, i’ll see sub-leftmenu1 and sub-leftmenu2 in the <div id="headersubnav">
              so when i click on leftmenu2, i’ll see sub-leftmenu3 and sub-leftmenu4 in the <div id="headersubnav">
              so when i click on leftmenu3, i’ll see sub-leftmenu15 and sub-leftmenu6 in the <div id="headersubnav">

              But that won’t


              Someyhing is wrong with:
              <div id="headersubnav">
              				[!Wayfinder? &startId=`[[UltimateParent]]` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]
              </div>
              

              When i have this code.....the topmenu with sub-topmenu’s works great.....but when i click on the leftmenu the leftmenu with their submenu appear in the id="headersubnav" instead only the sub-leftmenu

              It is a whole story, and hopefully clear
                • 23372
                • 7 Posts
                I have found a solution...but not the right one...but it works

                I’ve changed the snipped [[UltimatParent]]
                $top= isset ($top) && intval($top) ? $top : 0;

                to
                $top= isset ($top) && intval($top) ? $top : 3;


                it works, don’t ask me how?
                  • 22303 MODX Staff
                  • 10,725 Posts
                  FYI, [[UltimateParent? &top=`3`]] is the same thing as changing the snippet code...it’s a parameter.
                    • 7231
                    • 4,205 Posts
                    [!Wayfinder? &startId=`[[UltimateParent? &top=`3`]]` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]


                    It is a better idea to use it as a parameter as OpenGeek has suggested, otherwise you could get unexpected results when you use UltimateParent in other places.

                    it works, don’t ask me how?
                    By setting top=`3` you are telling it to not go beyond id 3. If you want the UltimateParent to return the sub of the current doc id relative to a level in the doc tree you could use &TopLevel=`2` to always return the second level deep menu.

                    * @example [[UltimateParent? &topLevel=`2`]]
                    * Will find the ultimate parent of the current document at a depth of 2 levels
                    * in the document hierarchy, with the root level being level 1.
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]