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

    I am at the fairly early stages of diving into MODx (Revo), and there are a few things I am having trouble wrapping my head around right now, so I am hoping someone can help me follow the right (or best) path.

    To begin, I run http://www.culturediscovery.com. It is a Joomla 2.5.x site, and has been for the past seven years. Since it has been so long, I am having trouble thinking outside fo the "Joomla way" for a few things.

    I am very quickly falling in love with MODx!!! I see the freedom in it, and it is VERY seductive! It seems o be everything I have been lacking, but I am very stuck in the "Module to Page" paradigm of Joomla, and how to convert that thinking to MODx. Let me clarify:

    Example: If you look at my site, and you go to pages that are about Tuscany and Umbria vacations, there is a dedicated menu just for those pages on the side bar. In Joomla, that menu is a module, and on the module settings, I select the menu items that represent pages I want that menu on. I am a similar scenario for all sorts of things throughout the site, and there are dozens of possible combinations.

    With MODx, it *seems* to me that I would either need to have a template for every combination I may want, OR I would need to put the menu structure in the [[*content]] and have chunks for each menu that are called in there.

    Please forgive the utterly entry level question, but is there a simple and more dynamic way to do this that I am missing?
    Are there any sample sites that can be downloaded that display what I am looking for? I have searched and searched, and I haven't seen this.



      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There are several ways this could be handled dynamically (as is usually the case with MODx).

      If your Resource Tree structure is arranged so that you have sections for each region, you could use Wayfinder or getResources snippet calls to generate the lists based on the children of each region's parent resource.

      Or, you can use a TV to categorize the resources by location, and use one of the tagging snippets like tagLister to fetch the resources with the appropriate TV values. You could even use the auto-tag TV type.
        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
        • 43902
        • 5 Posts
        OK, I need to play more with Wayfinder and getResources then smiley. I love (and kinda hate) that there are so many ways to do everything!
          • 38547
          • 98 Posts
          An example of a wayfinder menu call would be something like

          [[Wayfinder? startId=`5` &level=`0` &outerTpl=`wfOuterHistory` &ignoreHidden=`1`]]


          So with that above example it only shows all pages under the parent container with the ID of 5

          I actually have that inside of a chunk and I drop the chunk into the template where I want the menu to appear like so [[$historyPageMenu]] I find that makes editing the template easier in the future.

          I dont use this menu on a side bar but you can see it in action across the top of http://sudburymcc.co.uk/club-history.html

          Hope that helps its normally me asking advice.

          Cheers [ed. note: ianman last edited this post 13 years, 4 months ago.]
            • 43902
            • 5 Posts
            Actually, yes. It does help. I am pretty sure I will be refining my question at some point as I get deeper in this. I am feeling a little overwhelmed at the moment. You know how you get attracted to something because it is so flexible, then you get frustrated by it while learning BECAUSE it is so flexible... and finally you cannot imagine how you got by without it before because it is so flexible... I am squarely in that second stage right now smiley
              • 38547
              • 98 Posts
              Quote from: mkovnick at May 27, 2013, 09:06 AM
              I am squarely in that second stage right now smiley

              Yep I have been stuck in that 2nd stage for many years now (-:

              I am no pro at this do it just for fun however out of all the things I have discovered the best one is probably MIGx and using it for images, when you get your head around the basics check out
              http://www.youtube.com/watch?v=dE9-oZCqy9o
              I found getting gallery to work simply was not so easy however using the demo in the video also shows how amazing phpthumbof is and how easy it is to use anyway I am getting side tracked.

              Good luck
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Just to add to the confusion, you will at some point be interested in the @INHERIT binding for TVs; it will cause all the children of a resource to inherit its setting for the TV. It's very useful for setting the startId property for menus on inner pages. This article was written for Evolution, but the principle of the behavior of @INHERIT is the same. Here's the official documentation for @INHERIT and Revo http://rtfm.modx.com/display/revolution20/INHERIT+Binding
                  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
                  • 43902
                  • 5 Posts
                  ianman:
                  Well, I'm not doing it for fun, although I do enjoy this part of what I do. We are a fairly high profile tour company in Italy, so everything has to be perfect. The good news is that I have a pretty long lead time to port the site over from Joomla with the new design, so I can take my time and do it right smiley. On my way to watch that video now!

                  sottwell:
                  Thanks. Actually that makes sense. It will be all about putting everything together as I move forward.
                    • 25803 ☆ A M B ☆
                    • 721 Posts
                    If you look at my site, and you go to pages that are about Tuscany and Umbria vacations, there is a dedicated menu just for those pages on the side bar. In Joomla, that menu is a module, and on the module settings, I select the menu items that represent pages I want that menu on. I am a similar scenario for all sorts of things throughout the site, and there are dozens of possible combinations.

                    With MODX, you just structure your resource tree and then use Wayfinder to display the appropriate menus.
                    For example.

                    - Home
                    - Explore our Vacations (Document is a container (will look like a folder) and is the Parent of it's children))
                    -----> View Our Vacation Calendar
                    -----> Italy Cooking Vacations (Container Document)
                    ------------> About Our Cooking Vacations in Italy
                    ------------> Cooking Vacations in Tuscany and Umbria (Container Document)
                    ------------------> Wine & Cooking Under the Tuscan & Umbrian Sun
                    ------------------> Wine, Cooking, Truffles & Chocolate: A Foodie's Paradise
                    ------------------> Wine, Cooking, & The Olive Oil Harvest
                    ------------------> Medieval Chestnut Festival & Wine Harvest Season
                    ------------------> The Best of Both Worlds : Soriano and Norcia
                    ------------------> Cities Lost in Time
                    ------------> Cooking Vacations in Sicily
                    ------------> Cooking Vacations in Northern Italy
                    -----> Custom Group Vacations
                    -----> Day Tours & Cooking Classes from Rome

                    You could then place a Wayfinder call something like this:

                    [[!Wayfinder?
                    &startId=`[[UltimateParent]]`
                    &displayStart=`1`
                    &startItemTpl=`sidestarttpl`
                    &outerTpl=`smoutertpl`
                    &rowTpl=`smrowtpl`
                    &hereClass=`active`
                    &firstClass=``
                    &lastClass=``
                    ]]


                    For startID you can also use [[*id]] for the current document or [[*parent]] for the parent of the current document (which will show the children). UltimateParent is a snippet you can install (the instructions for it are buried in the snippet itself, there are none in the Add-Ons section of MODX documentation).

                    I like to use these rather than fixed document IDs to avoid having to make multiple Wayfinder calls.

                    The pair of displayStart and startItemTpl settings show the menu name of the parent document. For example, the startItemTpl chunk could be something like (note your code may differ in terms of structure but we generally use unordered lists:

                    <ul class="side-nav"><li[[+wf.classes]] id="firstsub">[[+wf.linktext]]</li>[[+wf.wrapper]]</ul>


                    [[+wf.wrapper]] will render the next level of the menu structure or list so that &outerTpl chunk (smoutertpl) could be:
                    [[+wf.wrapper]]


                    Which will just output a standard <ul><li>item 1</li><ul> type of list.

                    Within that, because we've specified the rowTpl, that chunk (smrowtpl) could be:
                    <li[[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a>[[+wf.wrapper]]</li>


                    or

                    <li[[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a></li>


                    The difference being that in the first version, because we have [[+wf.wrapper]] after the link but with the list item, we could go another level deeper and show the next level of documents if we wanted. Leaving out, in the second version, wouldn't allow for it.

                    One of the best ways to learn Wayfinder is just look at your site structure and take a page and put this in the template:

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


                    And then look at the code it outputs. The startItemTpl, outerTpl, rowTpl, and so forth (in the Wayfinder documentation) allows you to control the rendering of each level of the unordered list.


                    [ed. note: rx2 last edited this post 13 years, 4 months ago.]
                      • 22427
                      • 793 Posts
                      Quote from: rx2 at May 27, 2013, 06:39 PM

                      [[+wf.wrapper]] will render the next level of the menu structure or list so that &outerTpl chunk (smoutertpl) could be:
                      [[+wf.wrapper]]
                      Which will just output a standard <ul><li>item 1</li><ul> type of list.

                      To create this output you want the &outerTpl chunk (smoutertpl) like this:
                      <ul[[+wf.classes]]>[[+wf.wrapper]]</ul>