We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28100
    • 66 Posts
    After many, many hours climbing the learning curve I have Wayfinder nearly completely set up to work the way I want. Yay!! grin

    I have 2 instances of Wayfinder - 1 to call the main menu items horizontally and the other to list the sub items in a vertical menu in the sidebar. So far so good. The problems is though, that I have an h2 under which the submenu items get listed and when there aren’t any submenu items the h2 remains and I get the bright red text saying"No documents found for menu." which is true of course.

    So I’m not sure how to have the h2 show only if there are submenu items - nor how to remove the red text.

    Any enlightenment very much appreciated! smiley
      • 27708 MODX Staff
      • 2,502 Posts
      The easiest way to do this is to use the &tplOuter template and include those elements that surround your Wayfinder call. If there is nothing in the Wayfinder result, nothing will show up.

      http://wiki.modxcms.com/index.php/Wayfinder#Template_Parameters

      You will need to include in your Wayfinder call the &tplOuter and have it link to a chunk with something like the following:

      <h2>Submenu Title</h2>
          <ul id="subnav"[+wf.classes+]>[+wf.wrapper+]</ul>
      


      Hope this helps.

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 28100
        • 66 Posts
        Oh!  It really did help thank you.  I’ve still got the red text saying there no submenu items though and ...

        What I failed to mention, was that for the current development of this site I have a menu depth of 3.  In the next week  that is going to grow to around 6.  SO, if the menu depth is only 2 deep as in:

        Home
        Articles

        • Item1
        • Item2
        About

        It works a treat.  But if it’s 3 deep and Item1 has a submenu, then I get 2 outputs of the snippet/chunk call (and h2).  One for Item1 and one for the submenu of Item 1 and Item2 eg:

        Submenu
        Item1

        Submenu
        • submenu of item1
        Item2

        I have a hunch I need to wrap something in an innerTpl or row ... or something but nothing I’m trying is working.

        Do I need to give the <ul> an ’id’ (as you’ve done --"subnav"), and how much if any does my CSS come into play here?

        Also, if anyone knows of any links to articles which give demos of Wayfinder and the use of the chunks or just template chunks in general it would be much appreciated.  I’ve checked out muddydogpaws, the wiki and searched topics here but I’m still just ’not getting it’ as much as I’d like.


        Thanks.  wink
          • 5091
          • 332 Posts

          Also, if anyone knows of any links to articles which give demos of Wayfinder and the use of the chunks or just template chunks in general it would be much appreciated. I’ve checked out muddydogpaws, the wiki and searched topics here but I’m still just ’not getting it’ as much as I’d like.


          Thanks. wink

          Hi Sorry, I can’t help your wayfinder problem as I am also struggling with this snippet.

          Susan the other day posted this for me, inside there is zip file that you can download. I find the document extremely useful in making me understand better in setting up my dropdown menu.

          http://wiki.modxcms.com/index.php/Wayfinder200. Strangly,

          I couldn’t find this page from the Wiki, instead, it shows another page.
          http://wiki.modxcms.com/index.php/Wayfinder
          http://wiki.modxcms.com/index.php/Wayfinder200
            • 27708 MODX Staff
            • 2,502 Posts
            Could you show your wayfinder call and a screencap or a link?
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              On the Wayfinder200 page you’ll find the link to download the .zip file in the second sentence on the page:

              For a zipped HTML file that attempts to exhaustively document Wayfinder 2.0, click here: Wayfinder200_docs_v6.zip
                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
                • 28100
                • 66 Posts
                Thanks chinesedream.  I did have that .zip download but going back and having another look has helped.
                (Thanks sottwell, I did get the one in the second sentence)

                So far I’ve got to here:
                Template:
                <div id="sideMenu">
                		[!Wayfinder? &startId=`[[UltimateParent? &topLevel=`1`]]` &outerTpl=`outerTpl` &innerTpl=`innerTpl` &level=`4`&debug=`true`!]
                	</div> <!-- end sideMenu -->


                outerTpl chunk:
                <h2>Submenu</h2>
                    <ul [+wf.classes+] >[+wf.wrapper+]</ul>


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


                And that now presents itself in a basic form of what I want (structurally) so far ... except for the red text on pages where there are no submenus. smiley

                I was also wondering, how deep can you go with these menus?  Is there a limit?


                Thanks everyone!


                EDIT:
                Thanks to Firefox and Firebug, I found that the red text message was coming from the debug option. So once I removed debug - all is good.

                Just loving MODx by the way! Kudos to the wonderful team and of course, the community. smiley