{pager:target}

Description

The pager command renders a page scroller (for example « | 1 | 2 | 3 | ») 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 guard message shown in the first example instead of links. On a Site module page with a router the previous and next links are the « and » arrows; without a router (a view loaded by AJAX) they read Previous and Next in the UI language. 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>
Expected(a div whose links read 1 | 2 | 3 | » on page 1, with the current page as an active span; depends on the view and the current page)
Actual
Err in {pager} - pager not valid without a view, or for group display
The usual placement: the Bottom HTML of a view on a Site module page. Inside a view spanning several pages the engine emits router-correct links such as 1 | 2 | 3 and a next arrow on page 1 (the previous link is omitted on page 1). Here, outside a view, the live result is the guard message.
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.
test{pager:results}
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
With a div id as target the guard still comes first: outside a paginated view you get the same error text, and no script is requested.