CodeIgniter v4.5 API

PagerInterface

Expected behavior for a Pager

Table of Contents

Methods

getCurrentPage()  : int
Returns the number of the current page of results.
getDetails()  : array<string|int, mixed>
Returns an array with details about the results, including total, per_page, current_page, last_page, next_url, prev_url, from, to.
getFirstPage()  : int
Returns the first page.
getLastPage()  : int|null
Returns the last page, if we have a total that we can calculate with.
getNextPageURI()  : string|null
Returns the full URI to the next page of results, or null.
getPageCount()  : int
Returns the total number of pages.
getPageURI()  : string|URI
Returns the URI for a specific page for the specified group.
getPerPage()  : int
Returns the number of results per page that should be shown.
getPreviousPageURI()  : string|null
Returns the full URL to the previous page of results, or null.
hasMore()  : bool
Tells whether this group of results has any more pages of results.
links()  : string
Handles creating and displaying the
makeLinks()  : string
Allows for a simple, manual, form of pagination where all of the data is provided by the user. The URL is the current URI.
setPath()  : $this
Sets the path that an aliased group of links will use.
simpleLinks()  : string
Creates simple Next/Previous links, instead of full pagination.
store()  : $this
Stores a set of pagination data for later display. Most commonly used by the model to automate the process.

Methods

getCurrentPage()

Returns the number of the current page of results.

public getCurrentPage([string $group = 'default' ]) : int
Parameters
$group : string = 'default'
Return values
int

getDetails()

Returns an array with details about the results, including total, per_page, current_page, last_page, next_url, prev_url, from, to.

public getDetails([string $group = 'default' ]) : array<string|int, mixed>

Does not include the actual data. This data is suitable for adding a 'data' object to with the result set and converting to JSON.

Parameters
$group : string = 'default'
Return values
array<string|int, mixed>

getFirstPage()

Returns the first page.

public getFirstPage([string $group = 'default' ]) : int
Parameters
$group : string = 'default'
Return values
int

getLastPage()

Returns the last page, if we have a total that we can calculate with.

public getLastPage([string $group = 'default' ]) : int|null
Parameters
$group : string = 'default'
Return values
int|null

getNextPageURI()

Returns the full URI to the next page of results, or null.

public getNextPageURI([string $group = 'default' ]) : string|null
Parameters
$group : string = 'default'
Return values
string|null

getPageCount()

Returns the total number of pages.

public getPageCount([string $group = 'default' ]) : int
Parameters
$group : string = 'default'
Return values
int

getPageURI()

Returns the URI for a specific page for the specified group.

public getPageURI([int|null $page = null ][, string $group = 'default' ][, bool $returnObject = false ]) : string|URI
Parameters
$page : int|null = null
$group : string = 'default'
$returnObject : bool = false
Return values
string|URI

getPerPage()

Returns the number of results per page that should be shown.

public getPerPage([string $group = 'default' ]) : int
Parameters
$group : string = 'default'
Return values
int

getPreviousPageURI()

Returns the full URL to the previous page of results, or null.

public getPreviousPageURI([string $group = 'default' ]) : string|null
Parameters
$group : string = 'default'
Return values
string|null

hasMore()

Tells whether this group of results has any more pages of results.

public hasMore([string $group = 'default' ]) : bool
Parameters
$group : string = 'default'
Return values
bool

Handles creating and displaying the

public links([string $group = 'default' ][, string $template = 'default' ]) : string
Parameters
$group : string = 'default'
$template : string = 'default'

The output template alias to render.

Return values
string

Allows for a simple, manual, form of pagination where all of the data is provided by the user. The URL is the current URI.

public makeLinks(int $page, int $perPage, int $total[, string $template = 'default' ]) : string
Parameters
$page : int
$perPage : int
$total : int
$template : string = 'default'

The output template alias to render.

Return values
string

setPath()

Sets the path that an aliased group of links will use.

public setPath(string $path[, string $group = 'default' ]) : $this
Parameters
$path : string
$group : string = 'default'
Return values
$this

Creates simple Next/Previous links, instead of full pagination.

public simpleLinks([string $group = 'default' ][, string $template = 'default' ]) : string
Parameters
$group : string = 'default'
$template : string = 'default'
Return values
string

store()

Stores a set of pagination data for later display. Most commonly used by the model to automate the process.

public store(string $group, int $page, int $perPage, int $total) : $this
Parameters
$group : string
$page : int
$perPage : int
$total : int
Return values
$this

        
On this page

Search results