Paginator
Paginates over an array.
Summary
| Paginator | Paginates over an array. |
| Functions | |
| __construct | Prepares an array for pagination. |
| next | Returns the next pagination sequence. |
| prev | Returns the next pagination sequence. |
| next_page | Checks whether or not it makes sense to show the Next Page link. |
| prev_page | Checks whether or not it makes sense to show the Previous Page link. |
| next_link | Outputs a link to the next page. |
| prev_link | Outputs a link to the previous page. |
| next_page_url | Returns the URL to the next page. |
| prev_page_url | Returns the URL to the previous page. |
__construct
| public function __construct( | $array, | |||
| $per_page | = | 5, | ||
| $name | = | "page", | ||
| $model | = | true, | ||
| $page | = | null | ) |
Prepares an array for pagination.
Parameters
| $array | The array to paginate. |
| $per_page | Amount of items per page. |
| $name | The name of the $_GET parameter to use for determining the current page. |
| $model | If this is true, each item in $array that gets shown on the page will be initialized as a model of whatever is passed as the second argument to $array. The first argument of $array is expected to be an array of IDs. |
Returns
A paginated array $per_page or smaller.