{scroller:begin:end:add:nopage}

Description

Renders a numeric page scroller (pagination bar) for the view it is written in. Place it in a view body field, such as Bottom HTML, of a view that splits its items into pages with a Listlen. It outputs one link per page, plus Previous and Next, so visitors can step through long listings. The four optional parameters wrap and decorate the page numbers: begin is printed before the numbers, end after them, add is inserted inside each page link tag (typically an attribute such as a class), and nopage is the text shown when the result fits on a single page and no scroller is needed. scroller is the older, view-based pager. Inside Site module views use pager instead, which asks the router for clean page URLs. When scroller is expanded outside a valid paginating view (for example on this reference page) it cannot find an itemview and returns the literal notice: Scroller not valid without a view, or for group display.

Parameters

begin optional default (empty)

Text printed before the page numbers, for example a label like Page or an opening tag. Left empty by default.

end optional default (empty)

Text printed after the page numbers, for example a closing tag. Left empty by default.

add optional default (empty)

String inserted inside each page link tag, typically an HTML attribute such as class="blue". Spaces are preserved (this parameter is not trimmed). Left empty by default, so the links carry no extra attribute.

nopage optional default (empty)

Text returned when the listing fits on a single page and no scroller is needed. Left empty by default, so nothing is shown in that case.

Examples

test{scroller}
ExpectedScroller not valid without a view, or for group display
ActualScroller not valid without a view, or for group display
The simplest form. Written inside a view that paginates with a Listlen, it renders the page bar. Expanded outside a paginating view (as on this reference page) it has no itemview to read, so it returns the literal notice shown here. This is the signal that scroller is being used in the wrong place.
test{scroller:Page :}
ExpectedScroller not valid without a view, or for group display
ActualScroller not valid without a view, or for group display
The first parameter begin prints before the page numbers, here the label Page followed by a space. The trailing colon is the empty end parameter. With no valid view in this context the output is still the not-valid notice; inside a real paginating view it would read Page 1 2 3 ...
test{scroller:Page ::class="blue"}
ExpectedScroller not valid without a view, or for group display
ActualScroller not valid without a view, or for group display
The third parameter add is inserted inside every page link tag. Here it sets class="blue" on each link. Spaces in add are preserved (scroller does not trim its parameters). The second parameter end is empty (the double colon). Output is the not-valid notice here because there is no paginating view to scroll.
test{scroller:::class="scroller":Single page}
ExpectedScroller not valid without a view, or for group display
ActualScroller not valid without a view, or for group display
The fourth parameter nopage is the text returned when the listing fits on one page and no scroller is needed. Here begin and end are empty, add is class="scroller", and nopage is Single page. Note that nopage only applies inside a valid view; with no view at all (this page) scroller returns the not-valid notice instead.
virtual{scroller:Page : :class="scroller"}
Expected(Page 1 | 2 | 3)
1 | 2 | 3)">ActualScroller not valid without a view, or for group display
Illustrative. Put in the Bottom HTML of a view whose Listlen is, say, 10, against 25 matching items. The view has three pages, so scroller emits the page bar: the begin label Page, then a link per page with class scroller, separated by a pipe. The exact links and the active page depend on the current request, so this is not a fixed value and is shown here for illustration only.
virtual{scroller:::class="scroller":All items shown}
Expected(All items shown)
ActualScroller not valid without a view, or for group display
Illustrative. When the same view returns few enough items to fit on a single page, there is nothing to scroll, so scroller returns the nopage text (here All items shown) instead of a page bar. This lets you print a quiet message in place of an empty scroller. The result depends on the item count at request time, so it is illustrative.
Alternative: {pager}