tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/13295-navigation-troublesCascade CMS: Discussion 2015-12-14T14:00:01Ztag:help-archives.hannonhill.com,2010-02-09:Comment/386653342015-12-10T13:12:21Z2015-12-10T13:14:25ZNavigation Troubles<div><p>Hi,</p>
<p>The problem you have is that the line <code>#set(
$bluenavlinksubs = $_XPathTool.selectNodes( $bluenavlinks,
'bluenavlinksub' ) )</code> should be embedded in the
<code>foreach</code> loop (and <code>bluenavlink</code> should be
used inside the loop). After cleaning the code up a little, I have
this:</p>
<pre>
#set( $bluenavlinks = $_XPathTool.selectNodes( $contentRoot, 'bluenav/bluenavlink' ) )
#set( $pound = "#" )##
<ul class="nav navbar-nav">
#foreach( $bluenavlink in $bluenavlinks )
#if( $bluenavlink.getChild( "linking" ).value == "Internal Link" )
<li><a href="$_SerializerTool.serialize($bluenavlink.getChild('link').getChild('path'), true)">$_SerializerTool.serialize($bluenavlink.getChild('link-text'), true).trim()</a></li>
#elseif( $bluenavlink.getChild("linking").value =="External Link" )
<li><a href="$_SerializerTool.serialize($bluenavlink.getChild('external-link'), true)">$_SerializerTool.serialize($bluenavlink.getChild('link-text'), true).trim()</a></li>
#elseif( $bluenavlink.getChild("linking").value =="Drop Down" )
<li class="dropdown">
<a href="$pound" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">$_SerializerTool.serialize($bluenavlink.getChild('link-text'), true).trim()<span class="caret"></span></a>
#set( $bluenavlinksubs = $_XPathTool.selectNodes( $bluenavlink, 'bluenavlinksub' ) )
#if( $bluenavlinksubs.size() > 0 )
<ul class="dropdown-menu">
#foreach( $bluenavlinksub in $bluenavlinksubs )
#if( $bluenavlinksub.getChild("linking").value =="Internal Link" )
<li><a href="$_SerializerTool.serialize($bluenavlinksub.getChild('link').getChild('path'), true)">$_SerializerTool.serialize($bluenavlinksub.getChild('link-text'), true).trim()</a></li>
#elseif( $bluenavlinksub.getChild("linking").value =="External Link" )
<li><a href="$_SerializerTool.serialize($bluenavlinksub.getChild('external-link'), true)">$_SerializerTool.serialize($bluenavlinksub.getChild('link-text'), true).trim()</a></li>
#end
#end
</ul>
#end
</li>
#end
#end
</ul>
</pre>
<p>Since I used the xml you supplied, <code>$contentRoot</code>
points to the <code>system-data-structure</code> element.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/386653342015-12-10T18:35:37Z2015-12-10T18:35:37ZNavigation Troubles<div><p>Hi,</p>
<p>I also wanted to mention you can replace <code>#set( $pound =
"#" )##</code> with the Escape Tool's hash helper
<code>$_EscapeTool.h</code>. See <a href="http://velocity.apache.org/tools/devel/generic/EscapeTool.html#getH()">
http://velocity.apache.org/tools/devel/generic/EscapeTool.html#getH()</a>
for more info.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/386653342015-12-12T03:50:48Z2015-12-12T03:50:48ZNavigation Troubles<div><p>got it! thanks again Ryan and WMC</p></div>Nandotag:help-archives.hannonhill.com,2010-02-09:Comment/386653342015-12-14T14:00:00Z2015-12-14T14:00:00ZNavigation Troubles<div><p>Glad to hear you were able to get your format working!</p>
<p>I'm going to go ahead and close this discussion, please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffith