Display the pagination controls. Types supported by default are simple
, paginate
and advanced
. The base and format parameters are used only for the paginate view.
Function Definition
public function pagination ( $params = null )
Source File: /pods/classes/Pods.php
Since: 2.0
Parameters
PARAMETER | TYPE | DETAILS |
---|---|---|
$params | (array) | Associative array of parameters |
Additional Parameter Options
OPTION | TYPE | DEFAULT | DETAILS |
---|---|---|---|
type | (string) | advanced | Pagination style to use: advanced, simple, paginate, list |
label | (string) | Go to page: | Label text to appear next to pagination |
show_label | (boolean) | true | Whether to show the label text |
first_text | (string) | « First | Text for the First page |
prev_text | (string) | ‹ Previous | Text for the Previous page |
next_text | (string) | Next › | Text for the Next page |
last_text | (string) | Last » | Text for the Last page |
prev_next | (boolean) | true | Whether to show the Previous and Next text |
first_last | (boolean) | true | Whether to show the First and Last text |
limit | (int) | $this->limit | Items per page, inherited by anything run by find() |
page | (int) | $this->page | Current page number |
mid_size | (int) | 2 | How many numbers to either side of current page, but not including current page |
end_size | (int) | 1 | How many numbers on either the start and the end list edges |
total_found | (int) | $this->total_found() | Total items across all pagination |
page_var | (string) | $this->page_var | Pagination variable to use in URL |
base | (string) | {$url}{$append}%_% | Pagination Base URL |
format | (string) | {$this->page_var}=%#% | Pagination Format |
Returns
(string) Pagination HTML
Examples
<?php $pod = pods( 'my_pod' ); $params = array( 'limit' => 15 ); $pod->find( $params ); // Advanced Pagination echo $pod->pagination( array( 'type' => 'advanced' ) ); // Simple Pagination echo $pod->pagination( array( 'type' => 'simple' ) ); // Paginate echo $pod->pagination( array( 'type' => 'paginate' ) );