PHP Класс Pagination

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$defaults configuration

Защищенные свойства (Protected)

Свойство Тип Описание
$count total count of items
$limit the number of displayed rows
$offset the offset for the slice function
$options options
$page the current page
$pages the total number of pages
$rangeEnd the range end for ranged pagination
$rangeStart the range start for ranged pagination

Открытые методы

Метод Описание
__construct ( mixed $count, integer $limit, array $params = [] ) Constructor
__debuginfo ( ) : array Improved var_dump() output
countItems ( ) : integer Returns the total number of items in the collection
countPages ( ) : integer Returns the total number of pages
firstPage ( ) : integer Returns the number of the first page
firstPageURL ( ) : string Returns the url for the first page
hasNextPage ( ) : boolean Checks if there's a next page
hasPages ( ) : boolean Checks if multiple pages are needed or if the collection can be displayed on a single page
hasPrevPage ( ) : boolean Checks if there's a previous page
isFirstPage ( ) : boolean Checks if the current page is the first page
isLastPage ( ) : boolean Checks if the current page is the last page
items ( ) : integer Alternative for countItems()
lastPage ( ) : integer Returns the number of the last page
lastPageURL ( ) : string Returns the url for the last page
limit ( ) : integer Returns the chosen limit This is used for the slice() method together with the offset to get the correct items from collections
nextPage ( ) : integer Returns the number of the next page
nextPageURL ( ) : string Returns the url for the next page
numEnd ( ) : integer Returns the index number of the last item on the current page Can be used to display something like "Currently showing 1 - 10 of 123 items"
numStart ( ) : integer Returns the index number of the first item on the current page Can be used to display something like "Currently showing 1 - 10 of 123 items"
offset ( ) : integer Returns the current offset This is used for the slice() method together with the limit to get the correct items from collections
page ( ) : integer Returns the current page number
pageURL ( integer $page ) : string Returns a page url for any given page number
pages ( ) : integer Alternative for countPages()
prevPage ( ) : integer Returns the number of the previous page
prevPageURL ( ) : string Returns the url for the previous page
range ( $range = 5 ) : array Creates a range of page numbers for Google-like pagination
rangeEnd ( ) : integer Returns the last page of the created range
rangeStart ( ) : integer Returns the first page of the created range
redirect ( ) Redirects to an error page if the redirect option is set and the pagination is beyond the allowed boundaries
toArray ( ) : array Returns the most important pagination data into a readable array

Описание методов

__construct() публичный Метод

Constructor
public __construct ( mixed $count, integer $limit, array $params = [] )
$count mixed Either an integer or a Collection
$limit integer The number of items per page
$params array Additional parameters to control the pagination object

__debuginfo() публичный Метод

Improved var_dump() output
public __debuginfo ( ) : array
Результат array

countItems() публичный Метод

Returns the total number of items in the collection
public countItems ( ) : integer
Результат integer

countPages() публичный Метод

Returns the total number of pages
public countPages ( ) : integer
Результат integer

firstPage() публичный Метод

Returns the number of the first page
public firstPage ( ) : integer
Результат integer

firstPageURL() публичный Метод

Returns the url for the first page
public firstPageURL ( ) : string
Результат string

hasNextPage() публичный Метод

Checks if there's a next page
public hasNextPage ( ) : boolean
Результат boolean

hasPages() публичный Метод

Checks if multiple pages are needed or if the collection can be displayed on a single page
public hasPages ( ) : boolean
Результат boolean

hasPrevPage() публичный Метод

Checks if there's a previous page
public hasPrevPage ( ) : boolean
Результат boolean

isFirstPage() публичный Метод

Checks if the current page is the first page
public isFirstPage ( ) : boolean
Результат boolean

isLastPage() публичный Метод

Checks if the current page is the last page
public isLastPage ( ) : boolean
Результат boolean

items() публичный Метод

Alternative for countItems()
public items ( ) : integer
Результат integer

lastPage() публичный Метод

Returns the number of the last page
public lastPage ( ) : integer
Результат integer

lastPageURL() публичный Метод

Returns the url for the last page
public lastPageURL ( ) : string
Результат string

limit() публичный Метод

Returns the chosen limit This is used for the slice() method together with the offset to get the correct items from collections
public limit ( ) : integer
Результат integer

nextPage() публичный Метод

Returns the number of the next page
public nextPage ( ) : integer
Результат integer

nextPageURL() публичный Метод

Returns the url for the next page
public nextPageURL ( ) : string
Результат string

numEnd() публичный Метод

Returns the index number of the last item on the current page Can be used to display something like "Currently showing 1 - 10 of 123 items"
public numEnd ( ) : integer
Результат integer

numStart() публичный Метод

Returns the index number of the first item on the current page Can be used to display something like "Currently showing 1 - 10 of 123 items"
public numStart ( ) : integer
Результат integer

offset() публичный Метод

Returns the current offset This is used for the slice() method together with the limit to get the correct items from collections
public offset ( ) : integer
Результат integer

page() публичный Метод

Returns the current page number
public page ( ) : integer
Результат integer

pageURL() публичный Метод

Returns a page url for any given page number
public pageURL ( integer $page ) : string
$page integer The page number
Результат string The url

pages() публичный Метод

Alternative for countPages()
public pages ( ) : integer
Результат integer

prevPage() публичный Метод

Returns the number of the previous page
public prevPage ( ) : integer
Результат integer

prevPageURL() публичный Метод

Returns the url for the previous page
public prevPageURL ( ) : string
Результат string

range() публичный Метод

Creates a range of page numbers for Google-like pagination
public range ( $range = 5 ) : array
Результат array

rangeEnd() публичный Метод

Returns the last page of the created range
public rangeEnd ( ) : integer
Результат integer

rangeStart() публичный Метод

Returns the first page of the created range
public rangeStart ( ) : integer
Результат integer

redirect() публичный Метод

Redirects to an error page if the redirect option is set and the pagination is beyond the allowed boundaries
public redirect ( )

toArray() публичный Метод

Returns the most important pagination data into a readable array
public toArray ( ) : array
Результат array

Описание свойств

$count защищенное свойство

total count of items
protected $count

$defaults публичное статическое свойство

configuration
public static $defaults

$limit защищенное свойство

the number of displayed rows
protected $limit

$offset защищенное свойство

the offset for the slice function
protected $offset

$options защищенное свойство

options
protected $options

$page защищенное свойство

the current page
protected $page

$pages защищенное свойство

the total number of pages
protected $pages

$rangeEnd защищенное свойство

the range end for ranged pagination
protected $rangeEnd

$rangeStart защищенное свойство

the range start for ranged pagination
protected $rangeStart