We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41210
    • 10 Posts
    In my header I have a navigation bar which shows the top level items, and on content pages I want a column that shows the children of the top level nav items.Iv gotten it to show the children on the first page but not other pages. so on 'about us';

    home > about us

    Directions
    History

    but if I go to 'home > about us > directions' it does not show a list. It should show

    home > about us > directions

    Directions
    History

    Any way to do this without creating a template for every top level item?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There are a few ways to do this.

      I usually use a TV for the startId with the default being @INHERIT, then set the value in each parent resource. The children will all inherit the same value (i.e. their parent's ID) for the startId property.

      So for the "about us" page, set it to its own ID, and all of its children will use the same value. Don't set it to "[ [*id] ]", as then each of the children will inherit exactly that, and be trying to use their own IDs.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 41210
        • 10 Posts
        Quote from: sottwell at Sep 11, 2012, 11:07 AM
        There are a few ways to do this.

        I usually use a TV for the startId with the default being @INHERIT, then set the value in each parent resource. The children will all inherit the same value (i.e. their parent's ID) for the startId property.

        So for the "about us" page, set it to its own ID, and all of its children will use the same value. Don't set it to "[ [*id] ]", as then each of the children will inherit exactly that, and be trying to use their own IDs.

        I'm not exactly sure what you mean sottwell, is this a method of using Wayfinder with ModX TVs?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Create a TV with a default value of @INHERIT. Name it "parent".

          Your Wayfinder snippet for the side menu would look like this:
          [[Wayfinder? &startId=`[[*parent]]` &level=`1`]]


          Now you would need to set the value in each top-level resource to its own ID. Don't edit it at all for any of the child resources. The child resources will inherit the value of that top-level parent, setting the startId to where you want it for all the resources.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 41210
            • 10 Posts
            sorry scottwell but i'm a little new to modx. So i changed my snippit to use my TV. in my resources I set the TV it's ID so it looks like;

            About - 2(this # is the number in the TV field of the resource)
            Directions - 2
            Hours - 2

            So all should be good but the navigation is not showing up on the sub pages like 'Hours'.

            This is what the wayfinder call looks like in my template.

            [[Wayfinder? &startid=`[[*nav_parent]]`  &ignoreHidden=`true` &level=`1`]]
            [ed. note: swgamerx last edited this post 14 years ago.]
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              As I mentioned, do not edit the value at all for the child pages (Directions, Hours). Only edit it for the about page.

              When you create the TV nav_parent, set its default value (in the Input Options tab) to "@INHERIT".
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 41210
                • 10 Posts
                That is the thing though, I didn't add the number to the children, it filled itself in.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Ok, that's because it's set automatically by the @INHERIT default value.

                  And the side menu still doesn't appear? Try clearing the cache. (Site -> Clear Cache).
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 10208 ☆ A M B ☆
                    • 1,780 Posts
                    Try removing the &level=`1` parameter, or setting it to 0. Setting &level to 1 in a second or third level Wayfinder call won't work (at least it doesn't for me). I think it's looking for level 1, which isn't part of the result, so it's returning nothing.
                    edit: set &level to 3, 4, or 5, depending on your current level, see if that makes it show.

                    You also don't need &ignoreHidden, unless you're setting it to false. Wayfinder will automatically ignore hidden resources until you tell it not to.

                    If you want to show the page title of the current resource with Wayfinder, but not a self link, you can add &displayStart=`1` to the Wayfinder call to produce an h2 of the current page menu title above the menu itself.

                    [ed. note: frogabog last edited this post 14 years ago.]
                      Frogabog- MODX Websites in Portland Oregon
                      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                      Having server issues? These guys have MODX Hosting perfected - SkyToaster
                      • 41210
                      • 10 Posts
                      Quote from: frogabog at Sep 12, 2012, 08:26 PM
                      Try removing the &level=`1` parameter, or setting it to 0. Setting &level to 1 in a second or third level Wayfinder call won't work (at least it doesn't for me). I think it's looking for level 1, which isn't part of the result, so it's returning nothing.
                      edit: set &level to 3, 4, or 5, depending on your current level, see if that makes it show.

                      You also don't need &ignoreHidden, unless you're setting it to false. Wayfinder will automatically ignore hidden resources until you tell it not to.

                      If you want to show the page title of the current resource with Wayfinder, but not a self link, you can add &displayStart=`1` to the Wayfinder call to produce an h2 of the current page menu title above the menu itself.


                      I tried setting the level to different numbers, starting at 0 up to 4 and no luck. You would think this would be easy.