PHP Class Contao\Pagination

Show file Open project: contao/core-bundle Class Usage Examples

Protected Properties

Property Type Description
$arrData array Data array
$blnForceParam array Data array
$blnShowFirstLast boolean Show "<< first" and "last >>" links
$intNumberOfLinks integer Total number of links
$intPage integer Current page number
$intRows integer Total number of rows
$intRowsPerPage integer Number of rows per page
$intTotalPages integer Total number of pages
$lblFirst string Label for the "<< first" link
$lblLast string Label for the "last >>" link
$lblNext string Label for the "next >" link
$lblPrevious string Label for the "< previous" link
$lblTotal string Label for "total pages"
$objTemplate Template | object Template object
$strParameter string Page paramenter
$strUrl string Request url
$strVarConnector string Variable connector

Public Methods

Method Description
__construct ( integer $intRows, integer $intPerPage, integer $intNumberOfLinks = 7, string $strParameter = 'page', Template $objTemplate = null, boolean $blnForceParam = false ) Set the number of rows, the number of results per pages and the number of links
generate ( string $strSeparator = ' ' ) : string Generate the pagination menu and return it as HTML string
getItemsAsArray ( ) : array Generate all page links and return them as array
getItemsAsString ( string $strSeparator = ' ' ) : string Generate all page links separated with the given argument and return them as string
hasFirst ( ) : boolean Return true if the pagination menu has a "<< first" link
hasLast ( ) : boolean Return true if the pagination menu has a "last >>" link
hasNext ( ) : boolean Return true if the pagination menu has a "next >" link
hasPrevious ( ) : boolean Return true if the pagination menu has a "< previous" link

Protected Methods

Method Description
linkToPage ( integer $intPage ) : string Generate a link and return the URL

Method Details

__construct() public method

Set the number of rows, the number of results per pages and the number of links
public __construct ( integer $intRows, integer $intPerPage, integer $intNumberOfLinks = 7, string $strParameter = 'page', Template $objTemplate = null, boolean $blnForceParam = false )
$intRows integer The number of rows
$intPerPage integer The number of items per page
$intNumberOfLinks integer The number of links to generate
$strParameter string The parameter name
$objTemplate Template The template object
$blnForceParam boolean Force the URL parameter

generate() public method

Generate the pagination menu and return it as HTML string
public generate ( string $strSeparator = ' ' ) : string
$strSeparator string The separator string
return string The pagination menu as HTML string

getItemsAsArray() public method

Generate all page links and return them as array
public getItemsAsArray ( ) : array
return array The page links as array

getItemsAsString() public method

Generate all page links separated with the given argument and return them as string
public getItemsAsString ( string $strSeparator = ' ' ) : string
$strSeparator string The separator string
return string The page links as HTML string

hasFirst() public method

Return true if the pagination menu has a "<< first" link
public hasFirst ( ) : boolean
return boolean True if the pagination menu has a "<< first" link

hasLast() public method

Return true if the pagination menu has a "last >>" link
public hasLast ( ) : boolean
return boolean True if the pagination menu has a "last >>" link

hasNext() public method

Return true if the pagination menu has a "next >" link
public hasNext ( ) : boolean
return boolean True if the pagination menu has a "next >" link

hasPrevious() public method

Return true if the pagination menu has a "< previous" link
public hasPrevious ( ) : boolean
return boolean True if the pagination menu has a "< previous" link

linkToPage() protected method

Generate a link and return the URL
protected linkToPage ( integer $intPage ) : string
$intPage integer The page ID
return string The URL string

Property Details

$arrData protected property

Data array
protected array $arrData
return array

$blnForceParam protected property

Data array
protected array $blnForceParam
return array

$blnShowFirstLast protected property

Show "<< first" and "last >>" links
protected bool $blnShowFirstLast
return boolean

$intPage protected property

Current page number
protected int $intPage
return integer

$intRows protected property

Total number of rows
protected int $intRows
return integer

$intRowsPerPage protected property

Number of rows per page
protected int $intRowsPerPage
return integer

$intTotalPages protected property

Total number of pages
protected int $intTotalPages
return integer

$lblFirst protected property

Label for the "<< first" link
protected string $lblFirst
return string

$lblLast protected property

Label for the "last >>" link
protected string $lblLast
return string

$lblNext protected property

Label for the "next >" link
protected string $lblNext
return string

$lblPrevious protected property

Label for the "< previous" link
protected string $lblPrevious
return string

$lblTotal protected property

Label for "total pages"
protected string $lblTotal
return string

$objTemplate protected property

Template object
protected Template,contao|object $objTemplate
return Template | object

$strParameter protected property

Page paramenter
protected string $strParameter
return string

$strUrl protected property

Request url
protected string $strUrl
return string

$strVarConnector protected property

Variable connector
protected string $strVarConnector
return string