Pager::Pager

Pager::Pager() – Creates a pager instance

Synopsis

require_once 'Pager.php';

object &Pager ( array $options )

Deprecated

The constructor is deprecated in favour of the new factory() method, which is PHP5 compatible too.

Parameter

Pager constructor takes an associative array of parameters as input values. This is the complete list of these options:

  • itemData [array]

    Array of items to page.

  • totalItems [integer]

    Number of items to page (used only if itemData is not provided).

  • perPage [integer]

    Number of items to display on each page.

  • delta [integer]

    Number of page numbers to display before and after the current one.

  • mode [string]

    "Jumping" or "Sliding" -window - It determines pager behaviour.

  • expanded [boolean]

    if TRUE, window size is always 2*delta+1

  • linkClass [string]

    Name of CSS class used for link styling.

  • urlVar [string]

    Name of URL var used to indicate the page number. Default value is "pageID".

  • path [string]

    Complete path to the page (without the page name).

  • fileName [string]

    name of the page, with a "%d" if append == TRUE.

  • append [boolean]

    If TRUE pageID is appended as GET value to the URL. If FALSE it is embedded in the URL according to fileName specs.

  • altPrev [string]

    Alt text to display for prev page, on prev link. Default value is "previous page";

  • altNext [string]

    Alt text to display for next page, on next link. Default value is "next page";

  • altPage [string]

    Alt text to display before the page number. Default value is "page ".

  • prevImg [string]

    Something to display instead of "<<". It can be text such as "<< PREV" or an <img/> as well.

  • nextImg [string]

    Something to display instead of ">>". It can be text such as "NEXT >>" or an <img/> as well.

  • separator [string]

    What to use to separate numbers. It can be an <img/>, a comma, an hyphen, or whatever.

  • spacesBeforeSeparator [integer]

    Number of spaces before the separator.

  • spacesAfterSeparator [integer]

    Number of spaces after the separator.

  • firstPagePre [string]

    String used before first page number. It can be an <img/>, a "{", an empty string, or whatever.

  • firstPageText [string]

    String used in place of first page number.

  • firstPagePost [string]

    String used after first page number. It can be an <img/>, a "}", an empty string, or whatever.

  • lastPagePre [string]

    Similar to firstPagePre, but used for last page number.

  • lastPageText [string]

    Similar to firstPageText, but used for last page number.

  • lastPagePost [string]

    Similar to firstPagePost, but used for last page number.

  • curPageLinkClassName [string]

    Name of CSS class used for current page link.

  • clearIfVoid [boolean]

    if there's only one page, don't display pager (returns an empty string).

  • useSessions [boolean]

    if TRUE, number of items to display per page is stored in the $_SESSION[$_sessionVar] var.

  • closeSession [boolean]

    if TRUE, the session is closed just after R/W.

  • sessionVar [string]

    Name of the session var for perPage value. A value different from default can be useful when using more than one Pager istance in the page.

  • pearErrorMode [constant]

    PEAR_ERROR mode for raiseError(). Default is PEAR_ERROR_RETURN.

REQUIRED options are:

  • fileName IF append==FALSE (default is TRUE)

  • itemData OR totalItems (if itemData is set, totalItems is overwritten)

Return value

object - a specific Pager instance or a PEAR_Error object, if fails

Returns number of pages (Previous) Pager_Sliding (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.