We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47308
    • 68 Posts
    This is probably a basic question but I am a Modx newb with only lightweight technical knowledge. I am muddling through converting an HTML site to Modx and so far, it's worth it.

    I would like to create a top level menu item that is only there as a placeholder for the secondary menu. There would be no content and if the user clicks on it, it should just return # as the URL.

    In other words:

    Europe

    • France
    • Germany


    Hovering over Europe would just drop down the secondary menu.

    In Revolution, is there a way to create an empty resource? Or, is there a setting in Wayfinder to accomplish this.

    Thanks.

    This question has been answered by sottwell. See the first response.

    • Check the &categoryFoldersTpl property.

      Name of the chunk containing the template for category folders. Category folders are determined by setting the template to blank or by setting the link attributes field to rel="category".

      http://rtfm.modx.com/extras/evo/wayfinder#Wayfinder-TemplateParameters
        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
        • 47308
        • 68 Posts
        Thanks. I have a Resource set with a blank template. But I don't understand how a Chunk can be a template. I'm using Chunks to store HTML code that's reused throughout the site.

        Any examples?
        • Most of the snippets use chunks as tpls (we call them that to separate them from the site Templates) to allow you to format the snippet output. You can also specify the tpl inline in the snippet tags like
          &tpl=`@CODE <li>[[+pagetitle]]</li>`


          Some snippets also allow you to specify a file as well. Wayfinder also provides the &config=`whatever` property, where you can use a file named "whatever.config.php" stored in the core/components/wayfinder/configs/ folder. There are several sample config files there already.

          For example, by default Wayfinder uses
          <li[[+wf.id]][[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>[[+wf.wrapper]]</li>

          for each row. For your categoryFoldersTpl you would have a chunk with something like this, so that it won't have a link:
          <li[[+wf.id]][[+wf.classes]]>[[+wf.linktext]][[+wf.wrapper]]</li>


          You always need the [[+wf.wrapper]] placeholder; this holds the rest of the Wayfinder output to insert as the nested list in the row item if it has any children.

          You'll notice that these tpls use placeholders. Wayfinder gets each resource that it is going to list, and applies the tpl to each one in turn, creating the placeholders for each resource's values. You can also use several of the resource fields, including TVs, but you need to keep in mind that these are placeholders [[+fieldname]], not regular resource fields [[*fieldname.]]

          http://sottwell.com/links/wayfinder.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
            • 47308
            • 68 Posts
            Man, I think I am in over my head. Will try to muddle through this. Thanks for the handholding.
              • 47308
              • 68 Posts
              Here is what I tried with no success:

              Created a chunk called "category_menu_items".

              In that chunk, I have the following:
              <li[[+wf.id]][[+wf.classes]]>[[+wf.linktext]][[+wf.wrapper]]</li>

              In my Wayfarer call, in my template, I have:
              [[Wayfinder? &startId=`0`&level=`0` &categoryFoldersTpl=`category_menu_items`]]

              I have my resource set to 0 template. I also tried it with rel="category".

              No success in either case. The category link is still clickable. Can you see what I'm doing wrong? Do I actually have to edit the config file?
              • Heh. It becomes a bit more clear in time. Feel free to ask questions or for help any time you get stuck.
                  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
                  • 47308
                  • 68 Posts
                  Quote from: sottwell at May 13, 2014, 02:10 PM
                  Heh. It becomes a bit more clear in time. Feel free to ask questions or for help any time you get stuck.

                  Any chance you could look at my code above? I followed the directions in the e-book about Wayfinder. Doesn't seem to work.
                  • discuss.answer
                    That looks fine. I made a test template with the same Wayfinder call, and the same category_menu_items chunk, put rel="category" in the Link Attributes field of resources with children, and it did as expected ... those "category" items in the menu were not clickable.
                      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
                      • 47308
                      • 68 Posts
                      I should have updated this earlier but I was able to get category menu items to work once I migrated my modx to my server. On my local MAMP server, I could not get it to work. I uploaded the database to my server, left the code as is and it worked fine.

                      Thanks for your help.