Documentation


Navigation

The navigation tag creates lists of navigation links based on navigation groups defined in CP > Design -> Navigation.

Tags

{pyro:navigation:links}

Creates a list of links for a group.

Attributes

Name Default Required Description
group None Yes Required. The navigation group the tag should use.
list_tag* ul No Deprecated in v1.3.0 Replaced by list-tag
list-tag ul No Choose between ol and ul lists. The value of this is wrapped in brackets on either end.
tag li No Type of tag that surrounds each navigation item. The value of this is wrapped in brackets on either end.
class current No The class to use when an element is the current page.
separator None No String that separates each navigation item.
items_only* true No Deprecated in v1.3.0 Replaced by items-only
items-only true No true or false. Set if the output source code should be wrapped with an optional list_tag.
indent None No tab or space. Character used to indent the output of source code.
link_class* None No Deprecated in v1.3.0 Replaced by link-class
link-class None No The class names to apply in all anchor elements.
top link No Set to "text" and the top level menu items will be rendered as plain text instead of links.

Examples

Simple Usage

You can use the basic single-tag approach to output a chunk of HTML by itself. This will apply the class names to the <li> tags (default) and use the <a> tags (default) to wrap the anchors.

{pyro:navigation:links group="header"}

Return:

<li class="first current"><a href="http://localhost/pyrocms/index.php">Home</a></li><li class="last"><a href="...
http://www.google.com">About Us</a></li>

You can use the basic single-tag approach like this to output a chunk of HTML that renders indented source code and adds a custom class name to all link anchors.

{pyro:navigation:links group="header" indent="tab" link-class="foo"}

Return:

<li class="first current">
	<a href="http://localhost/pyrocms/index.php" class="foo">Home</a>
</li>
<li class="last">
	<a href="http://www.google.com" class="foo">About Us</a>
</li>

If you use nested links the default tag outputs the following html when menu items are arranged in a multilevel menu.

{pyro:navigation:links group="header" indent="tab"}

Return:
<li class="first current">
	<a href="http://example.com/home">Home</a>
</li>
<li class="">
	<a href="http://example.com/about-us">About Us</a>
	<ul>
		<li class="first">
			<a href="http://example.com/contact">Contact</a>
		</li>
		<li class="last">
			<a href="http://example.com/staff">Staff</a>
			<ul>
				<li class="single">
					<a href="http://example.com/history">History</a>
				</li>
			</ul>
		</li>
	</ul>
</li>
<li class="last">
	<a href="http://example.com/blog">Blog</a>
</li>

Advanced Options

You can use a combination of params to output a chunk of HTML that shows a short paragraph of navigation, using <p> as list_tag to wrap all items by disabling items_only and using the tag <span> to wrap each anchor link.

{pyro:navigation:links group="header" tag="span" class="active" separator="|" list-tag="p" items-only="false"}

Return:

<p><span class="first active"><a href="http://localhost/pyrocms/index.php">Home</a></span> | <span class="last">...
<ahref="http://www.google.com">About Us</a></span></p>

If this layout is not flexible enough you can use double-tags to control how each link is output yourself.

{pyro:navigation:links group="header"}
	<li class="menu-item"><a href="{pyro:url}" class="{class}">{title}</a></li>
{/pyro:navigation:links}