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:
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.]