Show TOC

Creating a Top-Level Navigation iViewLocate this document in the navigation structure

Use

The code sample below creates a one- or two-level top-level navigation iView by performing the following steps:

  1. Iterates through the initial nodes

  2. Saves the node that is selected

  3. After iterating through all the initial nodes, recalls the selected node and iterates through its children.

            <%@ taglib uri="NavigationTagLibrary" prefix="nav"%>

<%-- render first level --%>
<ul class="firstLevel">
    <nav:iterateInitialNavNodes>
        <li>
            <nav:ifNavNodeInSelectedPath>
                <nav:navNodeAnchor 
                    navigationMethod="byURL" 
                    useQuickLink="true"
                    anchorAttributes="class=\"selected\""/>
                <nav:storeNavNode id="first"/>
            </nav:ifNavNodeInSelectedPath>
            <nav:ifNotNavNodeInSelectedPath>
                <nav:navNodeAnchor 
                    navigationMethod="byURL" 
                    useQuickLink="true"/>
            </nav:ifNotNavNodeInSelectedPath>
        </li>
    </nav:iterateInitialNavNodes>
</ul>

<%-- render second level --%>
<nav:recallNavNode id="first">
<ul class="secondLevel">
    <nav:iterateNavNodeChildren>
        <li>
            <nav:ifNavNodeInSelectedPath>
                <nav:navNodeAnchor 
                    navigationMethod="byURL" 
                    useQuickLink="true"
                    anchorAttributes="class=\"selected\""/>
            </nav:ifNavNodeInSelectedPath>
            <nav:ifNotNavNodeInSelectedPath>
                <nav:navNodeAnchor 
                    navigationMethod="byURL" 
                    useQuickLink="true"/>
            </nav:ifNotNavNodeInSelectedPath>
        </li>
    </nav:iterateNavNodeChildren>
</ul>
</nav:recallNavNode>