Since phpFox version 4.6.0. Developers can control which paging style they want to use for their app listing pages.
loadmore
- Default).next_prev
).pagination
).To set paging mode, you use function setPagingMode
of class Phpfox_Search_Browse
.
Example:
// set paging mode $this->search()->browse()->setPagingMode('next_prev'); |
To get paging mode, you use function getPagingMode
of class Phpfox_Search_Browse
.
Example:
// get paging mode $this->search()->browse()->getPagingMode(); |
In order to configure paging style, you can simply add a key-value pair as below.
Example:
Phpfox_Pager::instance()->set(array( 'page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount(), // add below line to choose paging mode. // If paging mode was not set, it will be the default paging mode - Load more. 'paging_mode' => $this->search()->browse()->getPagingMode() )); |
Our pagination system also provides some parameters for customization.
Parameter name | Description | Values | Default | Loadmore mode | Next - Previous mode | Pagination mode |
---|---|---|---|---|---|---|
| Customize label for paging buttons | Array with following keys: | None | ✓ | ✓ | ✓ |
| Using icon or text for button label.<br>Note: this parameter only works when | true: using icon.<br>false: using text. | false | ✓ | ✓ | ✓ |
| Decide to show/hide disabled buttons | true: show disabled buttons.<br>false: hide disabled buttons. | false | ✕ | ✓ | ✓ |
| Toggle first/last buttons | true: show first/last buttons.<br>false: hide first/last buttons. | true | ✕ | ✕ | ✓ |
| Customize number of pages on pagination | Integer value | 2 | ✕ | ✕ | ✓ |
| Toggle next/prev buttons | true: show next/prev buttons.<br>false: hide next/prev buttons. | true | ✕ | ✕ | ✓ |
Phpfox_Pager::instance()->set(array( 'page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount(), 'paging_mode' => $this->search()->browse()->getPagingMode(), 'params' => [ //custom labels 'paging_labels' => [ 'first' => 'the first', 'last' => 'the last', 'previous' => 'previous item', 'next' => 'next item' ] ] )); |
Phpfox_Pager::instance()->set(array( 'page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount(), 'paging_mode' => $this->search()->browse()->getPagingMode(), 'params' => [ 'paging_show_icon' => true // use icon only ] )); |
Phpfox_Pager::instance()->set(array( 'page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount(), 'paging_mode' => $this->search()->browse()->getPagingMode(), 'params' => [ 'paging_show_disabled' => true // show disabled buttons ] )); |
Phpfox_Pager::instance()->set(array( 'page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount(), 'paging_mode' => $this->search()->browse()->getPagingMode(), 'params' => [ 'pagination_show_first_last' => false // hide first-last buttons ] )); |
Phpfox_Pager::instance()->set(array( 'page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount(), 'paging_mode' => $this->search()->browse()->getPagingMode(), 'params' => [ 'pagination_walk' => 3 // Number of pages on pagination ] )); |
Phpfox_Pager::instance()->set(array( 'page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount(), 'paging_mode' => $this->search()->browse()->getPagingMode(), 'params' => [ 'pagination_show_next_prev' => false // hide next-prev buttons ] )); |