We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36738
    • 14 Posts
    Hi there!

    Is it possible to limit only the parents and not the children in wayfinder (for Revolution)?


    Here is an example of the menu I would like to create with a limit of 5 parents:

    -
    ---
    ---
    ---
    -
    ---
    ---
    ---
    -
    ---
    ---
    ---
    -
    ---
    ---
    ---
    -
    ---
    ---
    ---

    You see? 5 parents with there children.
    Well this is what wayfinder does with the limit option:

    -
    ---
    ---
    ---
    -

    This is very frustrating, is there a way to make wayfinder act the way I want to? [ed. note: cas-designz last edited this post 15 years ago.]
      • 33337
      • 3,975 Posts
      Zaigham (aka zi) Reply #2, 15 years ago
      Please post your Wayfinder call.
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Mark Hamstra Reply #3, 15 years ago
        How are you deciding on what items to show in the menu?

        I usually set anything I don't want in the menu as "hidden from menu", and let Wayfinder just output the rest.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 14437
          • 31 Posts
          I would go with Marks solution and select the 'hide form menus' option in the resources you have as parent which you don't want in you navigation.
            • 36738
            • 14 Posts
            Hi first of all thanks for the replies.
            Normally I would have gone for that solution but the tree must be dynamic since it's used for my portfolio items.

            Some portfolio item have 2 children some only one and some items have none children.

            I hope you all understand what I just explained, otherwise I will post a screenshot of my super secret portfolio ;-)

            Thanks in advanced!
              • 22427
              • 793 Posts
              Use a Wayfinder call like this:
              [[!Wayfinder? 
                  &startId=`99` 
              	&level=`1`
              	&limit=`5`
              	&rowTpl=`adhocRowTpl`
              ]]
              Here you have to replace 99 by the Id of the container of your portfolio items.
              With &level=`1` you restrict the output to the top level, and so the &limit =`5` will display 5 items of this top level - but so far without their children, of course.

              To show the children too, you need the explicit &rowTpl parameter, wherein the placeholder
              [[+wf.wrapper]]
              is replaced by a second Wayfinder call having the actual Id as &startId:
              [[Wayfinder? &startId=`[[+id]]`]]
              E.g. the chunk adhocRowTpl could be:
              <li[[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>[[Wayfinder? &startId=`[[+id]]`]]</li>

              That should do it. [ed. note: ottogal last edited this post 15 years ago.]