DotAdmin User Guide
Paging Nav Templates
For navigation systems where a very large number of links need to be generated, the dotAdmin system uses a “paging” system, allowing <x> links to be shown per-page, with next/previous links to navigate between sets.
This technique is often used in conjunction with Product Navs, in cases where there are too many products in a given category to reasonably be displayed on one page.
Because we are “paging” between sets of links, and not between different documents, the document url (or “ID”) does not change. Instead, we link to the same page and add two arguments to tell the Nav what to do:
http://www.yoursite.com/content/{id}/?nav={nav}&page={page}
In the example above, we are passing two arguments:
{nav} - The ID of the Nav we are sending the argument to.
{page} - The page of this Nav that we would like to display.
All links within Paging Navs are formatted in this way, and must contain those two arguments.
Paging Navs use an extra pair of BLOCKs named paging and page_links to display the extra information required. These blocks are placed outside of any zonelist or pagelist blocks used in the Nav.
BLOCK paging
This block has two purposes. Firstly, it can be used to display information about what page the user is currently viewing, as shown in the example below:
<!--BLOCK {paging}-->
<p>Showing links {from} to {to} of {total}.</p>
<!--/BLOCK {paging}-->
On the first page of a nav which shows five links per-page, the above code might display:
Showing links 1 to 5 of 22.
The paging block can also show links to the next and previous pages of links:
<!--BLOCK {paging} -->
<p>
<a href="/content/{id}/?nav={nav}&page={previous}">
Previous
</a>
|
<a href="/content/{id}/?nav={nav}&page={next}">
Next
</a>
</p>
<!--/BLOCK {paging} -->
<!-- BLOCK {pagelist} -->
(generate links to the actual content pages here)
<!-- /BLOCK {pagelist} -->
The above example would look something like this:
Previous | Next
Note: On the first page of a Paging Nav, there would be no “previous” link, and on the last page, there would be no “next” link to display. You can use conditional instructions to only display the link tags if there is a page to link to:
<!--IF {previous}-->
<a href="/content/{id}/?nav={nav}&page={previous}">
<!--/IF {previous}-->
Previous
<!--IF {previous}-->
</a>
<!--/IF {previous}-->
BLOCK page_links
The page_links block appears within the paging block, and produces a list of all the pages in the nav. This lets the visitor jump to any page in the nav without having to click through numerous Previous / Next links.
<!--BLOCK {paging} -->
<!--BLOCK {page_links} -->
[<a href="/content/{id}/?nav={nav}&page={page}">
{page}
</a>]
<!--/BLOCK {page_links} -->
<!--/BLOCK {paging} -->
<!-- BLOCK {pagelist} -->
(generate links to the actual content pages here)
<!-- /BLOCK {pagelist} -->
The {link} placeholder produces a numeric ID for each page in the nav. The example above might generate HTML which looks like this:
[1] [2] [3] [4] [5]
You might want to highlight the page currently being viewed, or remove the link to it because the visitor is already there. We can do this by using conditional instructions and a special placeholder named {current}
<!-- IF {current} -->
[<b>{page}</b>]
<!-- /IF {current} -->
<!-- ELSE -->
[<a href="/content/{id}/?nav={nav}&page={page}">
{page}
</a>]
<!-- /ELSE -->
Of course we can use the features of BLOCKs paging and pagelist together. If we put the page_links inbetween the Previous and Next links from block paging, we might produce something like the example below:
Showing links 1 to 5 of 22
Previous [1] [2] [3] [4] [5] Next
Below is a list of all placeholders used in Paging Navs:
|
Placeholder
|
Output
|
|
{id}
|
The id (URL) of the document containing this nav. The document link doesn't change between pages in a paging nav.
|
|
{nav}
|
An ID used by the system to denote which Nav we are paging through.
|
|
{from}
|
BLOCK paging only: Number of the first link displayed on the current page.
|
|
{to}
|
BLOCK paging only: Number of the last link displayed on the current page.
|
|
{total}
|
BLOCK paging only: Number of links in total across all pages of this paging nav.
|
|
{previous}
|
BLOCK paging only: Numeric ID of the previous page in the Nav, if a previous page exists.
|
|
{next}
|
BLOCK paging only: Numeric ID of the next page in the Nav, if there is a subsequent page to link to.
|
|
{page}
|
BLOCK page_links only: Numeric ID for each page in the Nav.
|
|
{current}
|
BLOCK page_links only: Used in a conditional instruction (IF) to format the current page link differently from other repetitions of the block.
|
|