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

    I am _very_ new to MODX. I am using the cloud version (and I think I will stick to it, I am not really keen on running updates etc.). I used to work with Drupal a lot, and can appreciate what you did and how (way to go!).
    I created this simple web site:

    http://c0164.paas1.ams.modxcloud.com/

    It uses the StyleVantage template, which uses the Wayfinder.
    It uses it in two spots:

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

    And for the "side menu":

    <li>[[!Wayfinder? &level=`1`!]]</li>

    Now, I created some pages, I made 100% sure that they are not "Hidden from menu", and made sure they have a menu title. And yet, they don't seem to come out.
    Also, the second Wayfinder doesn't have a startId, which I *assume* will take the current page as the startID?

    Ah, wait a sec, I just re-read the documentation for Wayfinder, and figured out that the syntax changed (and the template prob didn't), and changed the wayfinder into:

    [[Wayfinder? &startId=`0` &level=`1`]]

    And... well, now it's showing "Main", but not the second page, "School".

    OK, questions:

    * Any hints on why only the first item is displayed?
    * If I omit the startId, does that mean that it will start form the current page?
    * Would I be better off with a different, more updated template? And can you guys suggest a _simple_ three column template with the main menu at the top, and the "sub-menu" on the left, that is 100% updated?
    * Using the cloud version, what version of ModX am I using? ModX revolution 2.2?

    Thank you!

    And, excellent impressive work. Sometimes less IS more.


    Merc.
      • 43193
      • 9 Posts
      Hi,

      Just found out the answer to my last question:

      Running version 2.2.6-pl
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You need to check your MODx tag syntax. If you want the snippet to be uncached, only put the ! at the beginning.
        [[!Wayfinder...]]


        In the case of Wayfinder and getResources, it is seldom necessary to call them uncached. Much better to call them cached, and let the whole page be cached. No reason to make the processor re-build the menu structure on each page request.
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Some of the older documentation (such as the two .pdf documents I provide on my site) were written for Evolution, not Revolution. While the functionality of the Wayfinder snippet is the same, the MODx tags are different.

          http://rtfm.modx.com/display/revolution20/Tag+Syntax
            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
            • 43193
            • 9 Posts
            Hi,

            Thanks for your help!
            I added the ! just to see if it was working properly, and still no joy -- I still only get "Main menu" in the top Wayfinder snipset...

            Merc.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              You should always have a startId. Using the default current resource as the startId can be very problematical - it will do exactly that, use the ID of the current resource. If you are on a child page, it has no children of its own, so the menu will be empty. What you really want is to have the startId be the ID of the parent resource, or even the grandparent. There are several ways you can do that.

              If you know that your menu will only go one level deep, you can use the [[*parent]] resource variable.
              [[Wayfinder? &startId=`[[*parent]]` ...]]


              Another way is to use a Template Variable with the default value of @INHERIT. Then in the parent resource, edit this TV to have its ID. Now, use the TV tag in your Wayfinder call
              [[Wayfinder? &startId=`[[*idTV]]` ...]]

              All of the children of this parent resource will inherit that same value.

              Another way is to install the UltimateParent snippet (in fact, that's why I wrote it many years ago). This code will travel up the current resource's parents until it gets to the top, and returns the ID of that top parent resource.
              [[Wayfinder? &startId=`[[UltimateParent]]` ...]]

                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
                • 43193
                • 9 Posts
                Hi,

                This is fantastic support and information -- thank you! laugh
                I see that you have a syntax to `execute` a snipset inside another one -- nice!

                But... my problem stays. Look here: http://c0164.paas1.ams.modxcloud.com/

                I swear there are other pages, and they all not "Hide from menu", and with a menu title, and with [! just in case I am seeing cached contents...

                And still, all I see is "Main" -- have a look! laugh

                Merc.
                  • 43193
                  • 9 Posts
                  Hi,

                  Sottwell, BTW, since this is hosted in the cloud, maybe you can have a look straight on the system to see why the pages are not showing up?

                  Just guessing you work for the great ModX guys...

                  Merc.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    I don't work for them, but I've worked with them for many years. I'd be happy to look at it for you, Cloud or not. I've sent you a Private Message.
                      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
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Ok, to begin with, Wayfinder generates a nested unordered list. Here is your HTML in your template:
                      <div id="menu">
                        <ul style="border:0;">
                          <li>
                            [[!Wayfinder? &startId=`0` &level=`1`]]	
                          </li>
                        </ul>
                      </div>

                      Here is what you need (use CSS to style it, for example to have no border):
                      <div id="menu">
                      [[Wayfinder? &startId=`0` &level=`1`]]
                      </div>


                      There are a number of problems with the sidebar menu. First, is the same structural problem you have with the main menu.
                      <div id="sidebar">
                        <h1>Sidebar Menu</h1>
                        <ul class="sidemenu">
                         <li>[[!Wayfinder? &level=`1`]]</li>
                        </ul>				
                      </div>

                      This should be
                      <div id="sidebar">
                        <h1>Sidebar Menu</h1>
                        [[Wayfinder? &level=`1` &outerClass=`sidemenu`]]	
                      </div>
                      


                      The other problem is that by using no &startId property, you are using the default "current" resource ID. Your current resource has no children (at the moment, none of your resources have children), so it cannot be the "parent" of anything. In your Tree, you have at this time two resources, the "home" page, and one unpublished resource. The unpublished resources won't show up on any menu in any case.

                      What you need to do is use a &startId property; what it should be for the sidebar menu depends on what, exactly, you want it to display a menu of. To begin with, to keep it simple, let's just use the [[*parent]] resource value.
                      <div id="sidebar">
                        <h1>Sidebar Menu</h1>
                        [[Wayfinder? &startId=`[[*parent]]` &level=`1` &outerClass=`sidemenu`]]	
                      </div>
                      


                      Here are some good references, including two .pdf files, for working with Wayfinder. Note that many of them were originally written for Evo, so the MODx tags need to be corrected for Revo. For example, [*parent*] becomes [[*parent]], and [+wf.wrapper+] becomes [[+wf.wrapper]]. [ed. note: sottwell last edited this post 13 years, 6 months ago.]
                        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