Constants

NUM_PLACEHOLDER

NUM_PLACEHOLDER

Properties

$totalItems

$totalItems : 

Type

$numPages

$numPages : 

Type

$itemsPerPage

$itemsPerPage : 

Type

$currentPage

$currentPage : 

Type

$urlPattern

$urlPattern : 

Type

$maxPagesToShow

$maxPagesToShow : 

Type

$previousText

$previousText : 

Type

$nextText

$nextText : 

Type

Methods

__construct()

__construct(integer  $totalItems, integer  $itemsPerPage, integer  $currentPage, string  $urlPattern = '') 

Parameters

integer $totalItems

The total number of items

integer $itemsPerPage

The number of items per page

integer $currentPage

The current page number

string $urlPattern

A URL for each page, with (:num) as a placeholder for the page number. Ex. '/foo/page/(:num)'

setMaxPagesToShow()

setMaxPagesToShow(integer  $maxPagesToShow) 

Parameters

integer $maxPagesToShow

Throws

\InvalidArgumentException

if $maxPagesToShow is less than 3

getMaxPagesToShow()

getMaxPagesToShow() : integer

Returns

integer

setCurrentPage()

setCurrentPage(integer  $currentPage) 

Parameters

integer $currentPage

getCurrentPage()

getCurrentPage() : integer

Returns

integer

setItemsPerPage()

setItemsPerPage(integer  $itemsPerPage) 

Parameters

integer $itemsPerPage

getItemsPerPage()

getItemsPerPage() : integer

Returns

integer

setTotalItems()

setTotalItems(integer  $totalItems) 

Parameters

integer $totalItems

getTotalItems()

getTotalItems() : integer

Returns

integer

getNumPages()

getNumPages() : integer

Returns

integer

setUrlPattern()

setUrlPattern(string  $urlPattern) 

Parameters

string $urlPattern

getUrlPattern()

getUrlPattern() : string

Returns

string

getPageUrl()

getPageUrl(integer  $pageNum) : string

Parameters

integer $pageNum

Returns

string

getNextPage()

getNextPage() 

getPrevPage()

getPrevPage() 

getNextUrl()

getNextUrl() 

getPrevUrl()

getPrevUrl() : string|null

Returns

string|null

getPages()

getPages() : array

Get an array of paginated page data.

Example: array( array ('num' => 1, 'url' => '/example/page/1', 'isCurrent' => false), array ('num' => '...', 'url' => NULL, 'isCurrent' => false), array ('num' => 3, 'url' => '/example/page/3', 'isCurrent' => false), array ('num' => 4, 'url' => '/example/page/4', 'isCurrent' => true ), array ('num' => 5, 'url' => '/example/page/5', 'isCurrent' => false), array ('num' => '...', 'url' => NULL, 'isCurrent' => false), array ('num' => 10, 'url' => '/example/page/10', 'isCurrent' => false), )

Returns

array

toHtml()

toHtml() : string

Render an HTML pagination control.

Returns

string

__toString()

__toString() 

getCurrentPageFirstItem()

getCurrentPageFirstItem() 

getCurrentPageLastItem()

getCurrentPageLastItem() 

setPreviousText()

setPreviousText(  $text) 

Parameters

$text

setNextText()

setNextText(  $text) 

Parameters

$text

updateNumPages()

updateNumPages() 

createPage()

createPage(integer  $pageNum, boolean  $isCurrent = false) : array

Create a page data structure.

Parameters

integer $pageNum
boolean $isCurrent

Returns

array

createPageEllipsis()

createPageEllipsis() : array

Returns

array