Home > The Template System > Nav Templates

Table of Contents

DotAdmin User Guide

Nav Templates

Note: The specifics of some of the more specialised Nav types are covered in detail on other pages in this section. This page deals with the general aspects of the most typical Nav templates.

Navs are included in other templates by using the {nav} placeholder qualifier. For example, putting the placeholder {nav features} in a page template would include the Nav with an ID of “features” in all pages which use that template.

Automated Navs in the dotAdmin system use <!-- BLOCK --> instructions to repeat a chunk of mark-up for each link which needs to be generated. The two most commonly used BLOCKs used when creating Navs are zonelist and pagelist.

Note: Full details of how to create and configure Navs can be found in the Nav System section of this documentation. This section only deals with the templates used to display Navs.

BLOCK zonelist

The zonelist block is used to display a list of zone index pages. A common use for a zone list is to show a list of top-level zones in a sidebar column, to form the “main menu” for the site.

<ul>
  <!-- BLOCK {zonelist} -->
    <li><a href="/content/{link}">{title}</a></li>
  <!-- /BLOCK {zonelist} -->
</ul>

A zone list; creates links to all the zones within the target zone.

Note: BLOCK {zonelist} is not available in Selective Navs - they only require a pagelist.

BLOCK pagelist

The pagelist block partners the zonelist block, and produces a list of pages or products within a given zone. Note that the pagelist block can be used on its own, without the accompanying zonelist, in Navs where you only want to display links to pages and not to zones.

<ul>
  <!-- BLOCK {zonelist} -->
    <li><a href="/content/{link}">{title}</a></li>
  <!-- /BLOCK {zonelist} -->

  <!-- BLOCK {pagelist} -->
    <li><a href="/content/{link}">{title}</a></li>
  <!-- /BLOCK {pagelist} -->
</ul>

Generating links to all the zones within the current zone, and to all the pages within the current zone.

Below is a list of all placeholders available for use in these two blocks.

Placeholder Output
{zone_title} Title of the target zone (available in zonelist only).
{page_title} The title of the target page or (in zonelist) the zone index page.
{link_title} Link title (if specified) of the target page or zone index page. Defaults to displaying the page title if no link title exists.
{zone} ID (url) of the target zone.
{link} The link path to the target page / zone index page. For use in the HREF attribute of links eg: <a href="/content/{link}">
{id} ID of the target page / zone index page.
{short_description} The Tagline / Short Description field for the page / zone index page.
{thumbnail_image} The full path of the Thumbnail Image for this link.
{pub_day} Publication date: Day of the month (DD).
{pub_month} Publication date: Numeric Month (MM).
{pub_year} Publication date: Year (YYYY).
{author} The Screen Name of the author of this page.

Putting Navs Inside Other Navs

In some cases, it can be useful to include a Nav inside another Nav. For example: Zone-based Navs can only display links to content within a given zone. If we had a situation where that Zone contains other Zones, this one Nav would not be able to display links to pages within those zones.

The solution is to put a Nav inside this Nav, within <-- BLOCK {zonelist} -->, to show links to content within any inner zones which may exist. An example is shown below:

<!-- IF {pagelist} -->
  <ul>

  <!-- BLOCK {pagelist} -->
    <li><a href="/content/{link}">{link_title}</a></li>
  <!-- /BLOCK {pagelist} -->

  </ul>
<!-- /IF {pagelist} -->

<!-- IF {zonelist} -->
  <ul>

  <!-- BLOCK {zonelist} -->
    <li><a href="/content/{link}">{link_title}</a></li>
    {nav innermenu}
  <!-- /BLOCK {zonelist} -->

  </ul>
<!-- /IF {zonelist} -->

Example of a Nav Template containing a Nav Placeholder.

The example template above is for a Zone-based Nav named “mainmenu”. Just like any other zone-based Nav, it generates a list of links to pages and zones, but pay close attention to the {zonelist} block. If there are zones to link to, then for each zone link it creates it also creates a Nav named “innermenu”. This Nav will generate links to content within any inner zones that exist.

The only requirement of the “innermenu” Nav is that it must have its Base Zone (see The Nav System) set to “All (User's Current Zone)”. This is because we do not know which zone (or zones) it will be creating links for.

Note: You may have already realised that if the innermenu Nav used the same template shown above which is used for the mainmenu Nav, it would also create copies of itself for any zones it finds within the “inner” zones, and so on, until no more zones are found. This would create a Nav which would link to every page in the entire website - a self-maintaining Site Map.

If you are viewing this documentation at the dotAdmin website, this is exactly the structure used to create the menu on the left-hand side of each page.