Since phpFox version 4.6.0. Developers can control which paging style they want to use for their app listing pages.
Available Styles
- Load more - scroll down for load more contents (
loadmore
- Default). - Next - previous buttons (
next_prev
).
...
- Paging with First, Next, 3, 4, 5, Previous, Last (
pagination
).
How to apply for your apps
Set paging mode for searching library
To set paging mode, you use function setPagingMode
of class Phpfox_Search_Browse
.
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
// set paging mode
$this->search()->browse()->setPagingMode('next_prev');
|
Get paging mode
To get paging mode, you use function getPagingMode
of class Phpfox_Search_Browse
.
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
// get paging mode
$this->search()->browse()->getPagingMode();
|
Configure paging style
In order to configure paging style, you can simply add a key-value pair as below.
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
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()
));
|
Advanced customization
Our pagination system also provides some parameters for customization.
Parameters
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 | ✕ | ✕ | ✓ |
Examples
Customize label for paging buttons
Code Block | ||||
---|---|---|---|---|
| ||||
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'
]
]
));
|
Using icon or text for button label
Code Block | ||||
---|---|---|---|---|
| ||||
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
]
));
|
Show disabled buttons
Code Block | ||||
---|---|---|---|---|
| ||||
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
]
));
|
Toggle first/last buttons
Code Block | ||||
---|---|---|---|---|
| ||||
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
]
));
|
Customize number of pages on pagination
Code Block | ||||
---|---|---|---|---|
| ||||
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
]
));
|
Toggle next/prev buttons
Code Block | ||||
---|---|---|---|---|
| ||||
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
]
));
|
...