Hi all, Newbie here still roughing it as I try to understand the ins and outs of MODX. I am now struggling with Wayfinder, trying to understand how to build my nav with it.
First, here is generic html of what I am trying to output:
<nav class="collapse">
<ul class="nav nav-pills" id="mainNav">
<li class="dropdown">
<a class="nav-link active" href="/">
Home
</a>
</li>
<li class="dropdown">
<a class="nav-link" href="#">
Products
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="#">Widgets</a>
</li>
<li class="dropdown-submenu">
<a class="dropdown-item" href="#">Gizmos</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Red Gizmos</a></li>
<li><a class="dropdown-item" href="#">Blue Gizmos</a></li>
<li><a class="dropdown-item" href="#">Yellow Gizmos</a></li>
</ul>
</li>
<li>
<a class="dropdown-item" href="#">Gadgets</a>
</li>
</ul>
</li>
<li class="dropdown">
<a class="nav-link" href="#">
About
</a>
</li>
</ul>
</nav>
As I read through Wayfinder docs, I THINK I am getting halfway there, by doing this:
Wayfinder Call:
[[Wayfinder?&startId=
0&level=
3&outerTpl=
navOuterTpl&parentRowTpl=
navParentTpl]]
navOuterTpl:
<nav class="collapse">
<ul class="nav nav-pills" id="mainNav">
[[+wf.wrapper]]
</ul>
</nav>
navParentTpl:
<li class="dropdown">
<a href="[[+wf.link]]" class="nav-link">[[+wf.title]]"</a>
[[+wf.wrapper]]
</li>
What I am missing (if I am doing this right so far) is:
- How do I get
active
in the class of the currently selected top-level menu item? - How do I get that 3rd level under Gizmos in there?
Hoping someone can help sort this out. As always, thanks in advance (and Merry Christmas!!)