PHP 클래스 Pagination

파일 보기 프로젝트 열기: getkirby/toolkit 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$defaults configuration

보호된 프로퍼티들

프로퍼티 타입 설명
$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