You are here

function theme_pagerer_adaptive in Pagerer 7

This theme provides links to pages following an adaptive logic.

Besides links to the 'neigborhood' of current page, creates page links which are adaptively getting closer to a target page, through subsequent calls to the links themselves. More or less, the principle is the same as of the binary search in an ordered list.

On a first call, the theme creates links to a list of pages in the neighborood of first page, plus a link to last page, plus links to 2 pages in the space between first and last page:

  • one to the middle,
  • one to the middle of the space between the first page and the one above

Example - current page in square brackets:

page 1 out of 252: ------------------------------------------------------------------- [1] 2 3 4 5 . +62 . +125 . 252 -------------------------------------------------------------------

On subsequent calls, if a link outside of the neighborhood (nicknamed 'adaptive link') is called, then we will assume that the 'target' page looked for is comprised within the interval between the pages to the left and to the right of the link invoked. So, the theme will restrict the range of the pages to be presented in the pager by setting these pages as the min and max boundaries (plus first and last page, which are always displayed to 'release' the restriction), and recalculating the middle and middle-of-the-middle to present the new links.

Example (following on from above):

click on +62, go to page 63 and lock page 5 (represented as -58 from 63) and 126 (represented as +63 from 63) as new boundaries: ------------------------------------------------------------------- 1 . -58 . -31 . -15 . 61 62 [63] 64 65 . +15 . +31 . +63 . 252 ------------------------------------------------------------------- note how also the space on the left is filled in with links having same absolute offset as the ones to the right.

and so on, click on -15, go to page 48 and lock page 32 (represented as -16 from 48) and 61 (represented as +13 from 48): ------------------------------------------------------------------- 1 . -16 . -8 . -4 . 46 47 [48] 49 50 . +4 . +8 . +13 . 252 -------------------------------------------------------------------

Like for the 'pagerer_progressive' theme, links are displayed either as a page number or as an offset from current page. This is controlled via the 'progr_links' theme variable, which can take a value either 'absolute' or 'relative'.

1 theme call to theme_pagerer_adaptive()
pagerer_example_page in ./pagerer_example.module
Build the pagerer example.

File

./pagerer.module, line 765
Pagerer

Code

function theme_pagerer_adaptive($variables) {
  return _pagerer_theme_handler('pagerer_adaptive', $variables);
}