vudev/pagination

此库为您提供了快速将分页功能添加到项目的机会。

v1.0.2 2021-11-30 20:11 UTC

This package is auto-updated.

Last update: 2024-09-29 05:56:49 UTC


README

php >= 5.3

安装

composer require vudev/pagination

描述

创建对象

$pagination = new Pagination(array(
    'count' => 269,
    'current_page' => $_GET['page']
));

可用的方法


对象 Pagination 的属性


额外的 temps 属性

  • start_text - 该属性改变“开始”按钮的文本,在超过5页的情况下显示;

  • next_text - 该属性改变“下一页”按钮的文本,在超过5页的情况下显示;

  • classes - 用于更改分页的样式。在此属性中仅指定用户自定义类

    • linkpage - 页码编号(1,2,3,4...)
    • current - 当前页码
    • start - “开始”文本
    • next - “下一页”文本

使用示例

<?php
use Vudev\Page\Pagination;

include __DIR__.'/vendor/autoload.php';

$pagination = new Pagination(array(
  'count' => 600,
  'current_page' => $_GET['page_n'],
  'page_count' => 25,
  'views_page' => 5,
  'query_key' => 'page_n',
  
  'temps' => array(
    'start_text' => 'На старт',
    'next_text' => 'вперед',
    'classes' => array(
      'linkpage' => 'pagination_linkpage',
      'current' => 'pagination_linkpage_current',
      'start' => 'pagination_start',
      'next' => 'pagination_next'
    ),
  )
)); 
?>

<p align="center" style="margin-top:15%;">
  <?php $pagination->pg_print();?>
</p>