a wee weblog, since 2006

Navigation Tag

Outputs an unordered list of nodes for building navigation on your site

{exp:taxonomy:nav tree_id="1" depth="10" entry_id="{entry_id}"}
    <a href="{node_url}">{node_title}</a>

{/exp:taxonomy:nav}

Example Output from visiting the node "Team"

<ul>
	<li class="node level_0 has_children active_parent"><a href="/">Home</a>
	<ul>
		<li class="node about_us level_1 has_children active_parent">
		<a href="http://example.com/page/about_us">About Us</a>
		<ul>
			<li class="node our_team level_2  active">
				<a href="http://example.com/page/our_team">Team</a>
			</li>
			<li class="node company_history level_2 ">
				<a href="http://example.com/page/company_history">History</a>
			</li>
		</ul>
		</li>
	</ul>
	</li>
</ul>

Navigation Tag Parameters

tree_id=

tree_id="1"

The id of the tree you want to fetch. This is a required parameter.

depth=

depth="10"

Set a limit on how many levels the generated list will go down. This is a required parameter.

NOTE: If you're using the root_node_lft parameter to output a tree which starts x levels down, you'll need to offset the depth parameter.
Example: if you wanted to start on a 5th level node, and display nodes at 2 levels below that, your depth parameter would be depth="7"

entry_id=

entry_id="{entry_id}"

By default the tag will look at the current uri, and match it against the node tree to find a match. If it finds a match, it will apply the css class 'active' to the active <li>. If your uri has any extra segments it will break this rule, so you can use this parameter to ensure the 'active' css class is applied, and enjoy the benefits of having the class 'active_parent' to ancestor <li> elements too.

root_node_lft=

root_node_lft="1"

Begins the navigation from the lft value of a given node. The root always has a lft value of 1.

@todo Might update this, the lft value isn't that easy to get without using the {node_lft} variable to see it!

display_root=

display_root="no"

Don't display the root node, default is 'yes'

Navigation Tag Variables

These varables are available between the tag pair

  • {node_id}
  • {node_title}
  • {node_url}
  • {node_active}
  • {node_lft}
  • {node_rgt}
  • {node_entry_id}
  • {node_custom_url}
  • {node_entry_title}
  • {node_entry_url_title}
  • {node_entry_status}
  • {node_entry_entry_date}
  • {node_entry_template_name}
  • {node_entry_template_group_name}
  • {node_has_children}
  • {node_next_child}
  • {node_level}

As captured 23 April 2010 · The archived original