We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3633
    • 84 Posts
    Thank you everyone for help.

    I am having problems trying to complete this wayfinder call:
    [!Wayfinder?&startId=`0` &sortBy=`menuindex` &outerTpl=`topnav` &level=`1`!]


    I need a focus on the menuindex, because as previously explain all of the document ids are messed up. The menu needs to display a range of menuindexes, the range for the top navigation is 1-15, and the side bar navigation should be 16+ - this is what I need someone to complete in the wayfinder call. I have searched for an answer and haven’t got anywhere. So can someone please help me with this?
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      bluegum, my apologies, but I get the feeling that you maybe you misunderstand how the menus are created and are sorted using a script like Wayfinder. Any of the menu-generation scripts (like WayFinder) simply selects a series of documents from the database and sorts by the MENU INDEX, not by the page id -- the page id is pretty much irrelevant for this purpose... they’re not "messed up", they just have a sequential order that the menu doesn’t particularly care about. A lot of CMS’s do this type of thing where they use a "float" number or a "sink" number to determine where the items appear in the sort, and MODx is no exception; there is also the option to hide a particular page from appearing in the menu.

      99% of the time, the order of the menu items is the same, no matter how you format it (i.e. the vertical and horizontal menus will contain the same items in the same order, but they don’t need to go to the same depth). If you need 2 menus to show entirely different items, then you’re going to have to write your own Snippet, but I’d HIGHLY recommend that you take a look at the sample site that comes in a default MODx install and deconstruct the WayFinder Snippet calls that are used in those templates. Some of the others in the thread have also posted helpful links detailing this common task of menu creation. The documentation on WayFinder is exhaustive -- it’s practically an eBook for your reference. I think you’d save a huge amount of time to research that and see if you can’t use it to solve your problem.
        • 30711
        • 70 Posts
        I learned everything I needed to know about Wayfinder from "The (almost) Complete Guide to Creating Menus in MODx Using Wayfinder"

        http://modxcms.com/forums/index.php/topic,34176.0.html
          • 2182
          • 11 Posts
          Hey, I’m using this:

          [!Wayfinder? &startId=`[[UltimateParent]]` &level=`0`!]

          to create a subnav on my sidebar. It shows all the pages in that main category just like I wanted and sets the active class so that it can be styled accordingly. Very nice! But my problem is that for some pages I’d like to include the main category (parent) in the list. Also, it would be useful to be able to set the active page to show as plain text, not linked. How can I do these things?

          Thanks!
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            1. Use the &displayStart=`1` parameter, along with its &startItemTpl=`chunkName` tpl parameter. Example:
            <h2>[+wf.linktext+]</h2>[+wf.wrapper+]


            2. Use a different template for the "here" item, using the &hereTpl=`chunkName` parameter. Example:
            <li[+wf.classes+]>
            <span>[+wf.linktext+]</span>
            [+wf.wrapper+]
            </li>


            http://www.muddydogpaws.com/development/wayfinder/parameters.html
              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
              • 2182
              • 11 Posts
              Thank you, but I have to admit I still don’t get it. I just started using this application a few days ago. Should I wrap the wayfinder in a <div> or something? Where should I place the code examples you provided and should I edit them somehow?

              Right now it looks like this:

              [!Wayfinder? &startId=`[[UltimateParent]]` &displayStart=`1` &level=`0`!]

              This will output (when browsing the parent page):

              <h2 class="active">Parent</h2>
              <ul>
              <li><a href="/parent/child-1" title="Child 1" >Child 1</a></li>
              <li class="last"><a href="/parent/child-2" title="Child 2" >Child 2</a></li>
              </ul>

              But I need the output to be something like:

              <ul>
              <li class="active"><a href="/parent" title="Parent" >Parent</a></li>
              <li><a href="/parent/child-1" title="Child 1" >Child 1</a></li>
              <li class="last"><a href="/parent/child-2" title="Child 2" >Child 2</a></li>
              </ul>
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                That will take a little fiddling with the various output tpls.

                You’ll need to have your startItemTpl carry the first part of the ul tag and put the text for the "parent" in the first li:
                <ul id="topnav"[+wf.classes+]>
                <li[+wf.classes+]>[+wf.linktext+]</li>
                [+wf.wrapper+]

                Then your outerTpl will handle the rest of the menu and the closing ul tag:
                [+wf.wrapper+] 
                </ul> 
                

                The [+wf.wrapper+] placeholder tells Wayfinder to continue doing its processing for the rest of the menu.
                  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
                  • 19226
                  • 7 Posts
                  I think I managed to do what you were looking for quite simply.

                  <div id="menu_upper">
                  [[!Wayfinder? &startId=`5` &displayStart !]]
                  </div>
                  <div id="menu_lower">
                  [[!Wayfinder? &startId=`6` &displayStart !]]
                  </div>
                  


                  id’s 5 and 6 are the resource IDs (not the menu IDs). These are actually two folders I created to hold the pages which appear in those menus. The folders themselves are not shown, only the pages that are below them.

                  My resource tree looks something like this:

                  Web
                    Upper Menu (5)
                      Page 1 (7)
                      Page 2 (3)
                      Page 3 (9)
                    Lower Menu (6)
                      Page A (12)
                      Page B (4)
                      Page C (2)
                  


                  As you can see, it does not matter if the document IDs are all random. They are only used to select the folder which contains the things that you want in your menu. In which case, my menus come out looking something like:
                  Page 1
                  Page 2
                  Page 3
                  
                  Page A
                  Page B
                  Page c
                  


                    • 31490
                    • 23 Posts
                    hi, I’m joining this conversation pretty late in the day. The explanation which mgrant gives is exactly what I am trying to do, and if I can do it with Wayfinder, that would be great. I have my top level navigation, ie. Home, Products, About etc, and then on each internal page, i am wanting to include a left hand nav which lists the 3 product categories. So my resource tree looks like this:

                    Home
                    Products
                    - Product A
                    - Product B
                    - Product C
                    About Us
                    Testimonials
                    etc

                    My problem is, when I insert the second navigation, and then tick the ’show in menu’ box on the product pages, ie. Product A, Product B, Product C, they all appear in the top navigation (and not in the left hand nav). I’m not sure how to specify to the wayfinder snippet that these pages should be excluded from the top nav, and instead be included in the left nav.

                    Am I missing a trick?
                      • 31490
                      • 23 Posts
                      Sorry, I think I have answered my own question, by using the following code:

                      [[Wayfinder? &startId=`0` &level=`1`]] for the top nav (only displays level 1 links)
                      and
                      [[Wayfinder? &startId=`2` &level=`2`]] for the side nav (only displays level 2 links).

                      Hopefully this helps someone else out who may be facing the same dilemma.

                      Vicky