Navigation Overview

Last edited: 11/8/2010

See also: Navigation API reference

Producing a simple nested navigation is easy:getContent(
  "navigation",
  "display:dropdown",
  );
This will create a set of nested unordered links (<ul> tags) as specified by the navigation module in the backend. Each list item (<li>) will have a unique id. If the current page is a navigation item the li will have the class of 'current'. Additionally, any direct parent items of the current page will also have a class of 'current'.

You can limit which levels of the navigation are returned as well:

getContent(
  "navigation",
  "display:dropdown",
  "bottomlevel:3"
  );

This would only show the first three levels of navigation.

You can also limit to a subsection of the navigation:

getContent(
  "navigation",
  "display:dropdown",
  "find:".$_GET['nav'],
  "toplevel:2",
  "id:sub"
  );

This will start the navigation at the second level and limit it to your current subsection.  Also notice the 'id' tag. This optional item will prefix itself onto the list item id's. This is useful if you have multiple nav's on a given page.

Custom Output

If you would like to customize the data presented inside of the list items you can add show tags as needed. This will leave the default <ul> and <li> tags in place to keep the structure of the navigation the same. The show tags only replace what is between the <li> tags.

getContent(
  "navigation",
  "display:dropdown",
  "show:<a href="__url__">__title__</a>",
  "show:<span>__description__</span>",
  );

Site Map

The site map works essentially the same as the nav. The key difference being that it will include non-navigation pages which have been assigned as children of navigation items.

getContent(
    "navigation",
    "display:sitemap"
  );

Bread Crumbs

If you would like to display the 'bread crumbs' of a current page you can use this:

getContent(
    "navigation",
    "display:breadcrumbs",
    "find:".$_GET['nav'],
    "delimiter: > ",
    "currentpage:yes"
  );

This will display the parent page(s) (and optionally the current page) of the current page.

Open in a new window

When adding or editing a nav link in the backend, there is a checkbox to "Open in a new window." By default, target="_blank" will be added to each link set with this option. There are two methods for overriding this default behavior: the newwindow parameter, and the __ifnewwindow__ tag.

The newwindow parameter works with each of the three display types: dropdown, sitemap, and breakcrumbs. When specified — i.e., newwindow:rel="external" — the value passed is added to the <a> tag.

The __ifnewwindow__ tag works with the dropdown display type when show tags are used.

See the Navigation API for specifics on each option with each display type.