We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I’d like to have a Wayfinder menu on each page that just shows the children of the current document plus links to the Home Page (doc 1) and the Contact Us page (doc 6).

    I want "Home" to be the first menu item and "Contact Us" to be the last.

    [!Wayfinder? &level=`1` &includeDocs=`1,6`!]

    seems like it ought to do this (with the menuindex for Home and Contact set appropriately) since &startId defaults to the current page, but it prints nothing at all. :’(

    I’ve tried some other combos but nothing has come close to what I want. Is this possible to do with a single Wayfinder call in the common template?

    I could put the home and contact menu items in manually before and after the Wayfinder call but that would mess up styling the "active" link and the Contact item would appear twice on the home page.

    Bob
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 25663 MODX Staff
      • 12,272 Posts
      I believe the includeDocs param only works when those docs are actually siblings of the other documents in that tree level.

      The only way to somewhat accomplish what you’re trying to do is to create weblinks pointing to those documents. Alternately I suppose you could create a custom snippet that effectively clones the output of a page into another one. I’ve often wanted to be able to have duplicate "clone" or "symlink" documents, where you edit the "master" doc, and all the clones would reflect the changes. This type of document would also allow you to maintain your position in menus. When you get sites with hundreds of pages, this gets handy. But alas, this isn’t easily doable in 096x or earlier.

      We should, coincidentally, be able to do this with 097. smiley
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 14050
        • 788 Posts
        includeDocs still requires the startID parameter. If you set the startID parameter to 0, then the wayfinder call would only include documents 1 and 6 as its output.

        I guess you could also have a wayfinder call that had a snippet generate the documents of the child you want and have something like:

        [!Wayfinder? &startID=`0` &level=`1` &includeDocs=`1,[[CommaDelimitedChildren? &acStartID=`CONTAINER #`]]6`!]
        


        And have a snippet called CommaDelimitedChildren (Or whatever you want) with the following code:

        <?php
        $acStartID = 6;
        $ids = $modx->getActiveChildren($acStartID);
        foreach ($ids as $id) {
        $output .= $id['id'] . ',';
        }
        return $output;
        ?>
        


        That should do what you want, or at least get you close. I am not going to say it is the most efficient way, but should at least be one way.

          Jesse R.
          Consider trying something new and extraordinary.
          Illinois Wine

          Have you considered donating to MODx lately?
          Donate now. Every contribution helps.
          • 3749
          • 24,544 Posts
          Thanks. It gave me an idea ...

          [!Wayfinder? &startId=`0` &level=`1` &includeDocs=`1,6`!]		
          [!Wayfinder? &level=`1`!]


          This doesn’t put the contact link on the bottom, but it gives me those two links in a separate menu a the top (or the bottom if I swap them). If I style it properly, I think I can live with it.

          I had assumed, though, that the &includeDocs code could just go to the database, get the info on  those two docs and add them to the menu. I don’t understand why it would ever need to use the &startId parameter, but I’m probably misunderstanding how it works.

          The Wayfinder documentation doesn’t seem to be very clear on when &startId is, and is not required. If it defaults to the current document, it seems that it shouldn’t ever be required.

          Bob
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 14050
            • 788 Posts
            The documentation for the parameters is better explained here:

            http://www.muddydogpaws.com/development/wayfinder/parameters.html

            Also, if you use my method, you should be able to get EXACTLY the results you are looking for.

            Say you had a container with the children you wanted to display in a menu:

            Home (ID = 1)
            Contact (ID = 6)
            Container (ID = cool
            -Child (ID = 10)
            -Child (ID = 11)
            -Child (ID = 12)

            Using this call and my snippet:

            [!Wayfinder? &startID=`0` &level=`1` &includeDocs=`1,[[CommaDelimitedChildren? &acStartID=`8`]]6`!]


            That should be evaluated to:
            [!Wayfinder? &startID=`0` &level=`1` &includeDocs=`1,10,11,12,6`!]


            Which with the appropriate menuidex would display exactly as you wanted.
              Jesse R.
              Consider trying something new and extraordinary.
              Illinois Wine

              Have you considered donating to MODx lately?
              Donate now. Every contribution helps.
              • 3749
              • 24,544 Posts
              Very cool (and really clever).

              Thanks! laugh

              Bob
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting