Paul du Coudray
posted this on November 6, 2011, 18:13
Is there an easy way to enable a pass-through menu item on the main navigation so that when using the drop-down menu the main nav item is not linkable (and does not count towards an actual Page for the pricing scheme) ?
Comments
Paul,
There is a way to do this. Here is the logic:
1) When inside the <w:menu><w:each> context test each menu item for submenu items.
2) If it has a submenu do not display the item out as a link. If it does then make it a link.
Using our stock menu code and adjusting it slightly we end up with this:
<w:menu>
<div id='linkContainer'>
<ul id="nav" class="sf-menu sf-shadow">
<w:each>
<li>
<w:unless_submenu>
<a href='<w:url />' <w:if_ancestor_or_self>class="current"</w:if_ancestor_or_self>><w:label /></a>
</w:unless_submenu>
<w:if_submenu>
<w:label />
<ul>
<w:submenu:each>
<li>
<a href='<w:url />'><w:label /></a>
<w:if_submenu>
<ul>
<w:submenu:each>
<li><a href='<w:url />'><w:label /></a></li>
</w:submenu:each>
</ul>
</w:if_submenu>
</li>
</w:submenu:each>
</ul>
</w:if_submenu>
</li>
</w:each>
</ul>
</div>
</w:menu>
Notice the use of <w:unless_submenu> and <w:if_submenu>. In the case of <w:if_submenu> we only display out the menu item's <w:label/>. In the case of <w:unless_submenu> we wrap that label in an html <a href=""> tag.
Works perfectly. Thanks so much...