run diz/pagination

高度可定制的PHP分页类。

3.1.0 2021-02-06 14:57 UTC

This package is auto-updated.

Last update: 2024-09-06 23:16:02 UTC


README

PHP分页。
高度可定制的PHP分页类。

Latest Stable Version License Total Downloads

示例

// You don't need to include or require file if you install via Composer.
require_once '../Rundiz/Pagination/Pagination.php';

$total_records = 1000;
$start = (isset($_GET['start']) ? intval($_GET['start']) : 0);
if ($start < 0) {
    $start = 0;
}
$limit = 10;

$Pagination = new \Rundiz\Pagination\Pagination();
// Set options to the pagination class.
$Pagination->base_url = 'https:///your-project/page.php?start=%PAGENUMBER%';// *This property must be set.
$Pagination->total_records = $total_records;// *This property must be set.
$Pagination->page_number_value = $start;// *This property must be set.
echo $Pagination->createLinks();

更多示例在tests文件夹中。

分页部分描述

Pagination

  • "不可用前"的项目数量可以通过"unavailable_before"属性设置。示例:$Pagination->unavailable_before = 1;
  • "不可用"文本可以通过"unavailable_text"属性设置。示例:$Pagination->unavailable_text = '..';
  • "相邻页面"可以通过"number_adjacent_pages"属性设置数量。示例:$Pagination->number_adjacent_pages = 3;
  • "不可用后"的项目数量可以通过"unavailable_after"属性设置。示例:$Pagination->unavailable_after = 2;