We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21417
    • 486 Posts
    Hello,

    I am wanting to display a subnav using Wayfinder but am having trouble including the parent doc (contact us) in the menu.

    The items I want to show are as follows:

    +Contact Us
    - Email Form
    - Booking Form
    - Getting Here

    Where Contact Us has a doc id of 14.

    My wayfinder call is as follows:

    [[Wayfinder? &startId=`14` &level=`2` &titleOfLinks=`description` &sortBy=`menuindex`]]

    But what I end up with is this without the Contact Us link:

    - Email Form
    - Booking Form
    - Getting Here

    Any ideas?

    Thanks in advance.
      Web design Adelaide
      http://gocreate.com.au
      • 24393
      • 83 Posts
      &displayStart=`true`
        stevesunderland.com
        GRAPHICS | INTERACTIVE | MARKETING
        xhtml + ajax + seo websites powered by modx
        • 16183
        • 1,390 Posts
        Hi Nickf08,

        A quick one...by default, WF will list the descendant documents of the document you declare as the &startId...(meaning the &startId document itself is not shown in the output but only its descendants). You can override this behaviour in a number of ways depending on the situation:

        1. By using the &startId of the parent of the document "Contact us", which may be the root, so  &startId=`0`  - but this may include other documents in your menu that you do not want. Depending on how many they are, it may be practical/feasible to use either the &excludeDocs or &includeDocs to respectively exclude or include documents that you do not want/want in your menu

        2. By using the parameters &displayStart and &startItemTpl - In this case you will need to set the value of &displayStart to `1` i.e. true and then create a &startItemTpl  (or let WF use its default in-built &startItemTpl ). In this case, your &startId MUST BE something other than `0`. You could set it to `14` and it will work.

        The default WF &startItemTpl looks like so:

        <h2>[+wf.linktext+]</h2>[+wf.wrapper+]


        You can create yours differently if you want..

        If you use method 2 above, set &startId=`14`and let WF use its default &startItemTpl, your menu structure will end up as follows:

        <h2>Contact Us</h2>
        <ul>
        <li>Email Form</li>
        <li>Booking Form</li>
        <li>Getting Here</li>
        </ul>
        


        I am writing this in a hurry and it probably doesn’t make sense. You may want to read the documentation for further help...I will check this post in the morning to see how you are getting along...

        cheers/k
          • 21417
          • 486 Posts
          Hello Kogondo,

          Thank you very much - your explanation was excellent.

          Took a little tweaking to get it working / looking how I wanted.

          Before posting, I initially did it with include docs - but then if a new page was added the client would have to mess with the subnav call - your advice helped overcome that need so thanks a lot!

          subnav call:
          [[Wayfinder? &startId=`14` &level=`0` &displayStart=`1` &startItemTpl=`subnavStartItem` &innerTpl=`subnavInnerTpl` &titleOfLinks=`menutitle` &sortBy=`menuindex`]]


          &startItemTpl:
          <ul>
          <li><a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>
          [+wf.wrapper+]
          </li>
          </ul>


          &innerTpl:
          <ul>
          [+wf.wrapper+]
          </ul>
          


          End result:
          <ul>
            <li>Contact Us
            <ul>
             <li>Email Form</li>
             <li>Booking Form</li>
             <li>Getting Here</li>
            </ul>
           </li>
          </ul>


          Thanks so much for your help!!

            Web design Adelaide
            http://gocreate.com.au
            • 16183
            • 1,390 Posts
            Glad u got it working  grin

            As a by the way, for (my) learning purposes:

            One thing am curious about....

            Since the "Contact Us" is wrapped in the &startItemTpl, and the [+wf.wrapper+] placeholder of the &startItemTpl is where WF by default places the output of &outerTpl, it would seem to me that your &innerTpl is actually not being used.

            My reasoning is this: The WF template hierarchy is as follows:

            &startItemTpl
            &outerTpl
            &rowTpl
            &innerTpl
            &innerRowTpl


            So, in your menu, the template hierarchy is as follows:

            "Contact us" is wrapped in the start item template (&startItemTpl).

            The "Email Form", "Booking Form" and "Getting Here" come next and so are wrapped in the &outerTpl. Individually, each of the documents is wrapped in a &rowTpl. Nothing comes below them (no sub-docs) so no &innerTpl is being used in the current menu. The menu works coz WF is using its inbuilt &outerTpl (which basically looks like your &innerTpl).

            I raise this because a problem would arise if you wanted to use the &innerTpl WF class parameter, &innerClass. Since, if I’m correct, in your menu, no &innerTpl is being used, whatever value (class name) you give &innerClass will not be applied to your menu.

            I guess the only way to find out if I’m correct is to try and apply &innerClass and see if WF applies it to the menu (or even temporarily remove the &innerTpl from your call and see if the menu still works).

            Hey, don’t be distracted by my rumblings; but this could probably be useful in the future wink......all the best with your project! grin

            /k
              • 21417
              • 486 Posts
              Hello K,

              Thanks for that - sorry for the late reply - I was away on break.

              You are right - thanks for clearing that up.

              Changing &innerTpl to &outerTpl made no difference to the sub menu - neither did removing it all together - so that’s what I did - no reference and it still works a treat.

              So the correct call for me would be:

              [[Wayfinder? &startId=`14` &level=`0` &displayStart=`1` &startItemTpl=`subnavStartItem` &titleOfLinks=`menutitle` &sortBy=`menuindex`]]
              


              Thanks so much for your "rumblings"!!

              All the best.

              Nick
                Web design Adelaide
                http://gocreate.com.au
                • 16183
                • 1,390 Posts
                Nick,

                Thanks for the feedback.. grin

                cheers/k