Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Since phpFox version 4.6.0. Developers can control which paging style they want to use for their app listing pages.

Available Styles

  1. Load more - scroll down for load more contents (loadmore - Default).
  2. Next - previous buttons (next_prev).

...

  1. 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
php
php

// 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
php
php

// 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
php
php

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

paging_labels

Customize label for paging buttons

Array with following keys: first, last, previous, next.

None

paging_show_icon

Using icon or text for button label.<br>Note: this parameter only works when pending_labels did not set.

true: using icon.<br>false: using text.

false

paging_show_disabled

Decide to show/hide disabled buttons

true: show disabled buttons.<br>false: hide disabled buttons.

false

pagination_show_first_last

Toggle first/last buttons

true: show first/last buttons.<br>false: hide first/last buttons.

true

pagination_walk

Customize number of pages on pagination

Integer value

2

pagination_show_next_prev

Toggle next/prev buttons

true: show next/prev buttons.<br>false: hide next/prev buttons.

true

Examples

Customize label for paging buttons
Code Block
php
php

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
php
php

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
php
php

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
php
php

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
php
php

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
php
php

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
    ]
));

...