{pager:target}

Description

The pager command renders a page scroller (Previous | 1 | 2 | 3 | Next) for the view it sits in. Use it in views that belong to a site built on the Site module - typically drop it into the views Bottom HTML field. It calls the router, so the page links carry the correct SEO-friendly URLs for each page. The pager must be issued inside a view; outside a paginated view it returns the error string "Err in pager - pager not valid without a view, or for group display". The optional target is a div id: when given, the page links reload that div via AJAX (handy for live searches) instead of reloading the whole page. With fewer than two pages it renders nothing.

Parameters

target optional

Optional div id. When omitted, the pager renders normal page links that reload the page. When set to the id of the div that holds the views output, the page links reload only that div via AJAX (AA_Ajax), which suits live searches and in-place paging.

Examples

test{pager}
ExpectedErr in {pager} - pager not valid without a view, or for group display
ActualErr in {pager} - pager not valid without a view, or for group display
The pager only works inside a paginated view. On its own (no view around it) it returns this exact guard message instead of links. This is the one fully deterministic case, which is why it is the only verified test here - real scroller output depends on a live view and its current page.
virtual<div class="pager">{pager}</div>
Expecteda div whose links read 1 | 2 | 3 | Next, with the current page as a plain active span and the others as router-correct page-N links (depends on the view and current page)
Actual
Err in {pager} - pager not valid without a view, or for group display
The canonical real-world pattern: drop {pager} into the views Bottom HTML so the page links appear under the listing. Inside a Site-module view spanning several pages the engine emits router-correct links, e.g. (Previous links are omitted on page 1). Runtime-dependent, so shown illustratively.
virtual{pager:results}
Expectedthe same page links, but each one runs AA_Ajax(results, url) onclick to reload only the results div instead of the whole page (depends on the view and current page)
ActualErr in {pager} - pager not valid without a view, or for group display
Pass a div id to page in place via AJAX instead of reloading. The view output must live in a div with that id, e.g. <div id="results">...view...</div>. Each link then runs AA_Ajax(results, url) to refresh only that div - useful for live searches. Runtime-dependent, so shown illustratively.