Hello,
I'm trying to solve the following wayfinder-problem:
My website has ressources which have childs - an ressources without. Therefore I need a menu which provides dropdown menu for some items while at the same time menu items without any dropdown.
I'm using modx revo 2.2.14pl & bootstrap 3.
This is what it should look like:
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="[[~3]]">contact</a></li>
<li><a href="[[~46]]">mail</a></li>
<!-- Menu item with Dropdown -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">service <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="[[~4]]">order</a></li> <li><a href="#">order</a></li>
<li><a href="#">newsletter</a></li>
</ul>
<li><a href="#">login</a></li>
</ul>
This is my status right now:
Wayfinder-call:
[[!Wayfinder?
&startId=`0`
&outerTpl=`MenuOuter`
&rowTpl=`MenuOuterRow`
&innerTpl=`MenuInner`
]]
Templates:
MenuOuter:
<ul class="nav navbar-nav">[[+wf.wrapper]]</ul>
MenuOuterRow:
<li [[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>[[+wf.wrapper]]</li>
MenuInner:
<ul class="dropdown-menu">[[+wf.wrapper]]</ul>
And as expected this is getting me to this output:
<ul class="nav navbar-nav">
<li class="first active"><a href="http://xyz.com/" title="Home" >Home</a></li>
<li ><a href="contact/" title="contact">contact</a></li>
<li ><a href="mail/" title="mail">mail</a></li>
<li ><a href="service/" title="service">service</a>
<ul class="dropdown-menu">
<li class="first"><a href="order.html" title="order">order</a></li>
<li ><a href="newsletter.html" title="newsletter">newsletter</a></li>
</ul>
</li>
<li ><a href="login/" title="login">login</a></li>
</ul>
Obviously there's missing a part to the <li>service></li> to make the dropdown-menu working:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">service <b class="caret"></b></a>
I cant't get a clue to how to solve the problem: only make the "dropdown"-additions to a <li> when there are childs of a ressource, but adding nothing, if there are no childs..
Calvar