定制 diversen/simple-pager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

diversen/simple-pager

最新稳定版本:v1.3.29

Composer 安装命令:

composer require diversen/simple-pager

包简介

A simple pager wrapper around pear-pager

README 文档

README

The pagination class is a simple wrapper around PEAR::Pager

It works by knowing the the $_GET['from'] part of the query, and from this param the class knows what will be the next page in the set. You don't need to think about this, as the pagination class will take care of this:

Install

As with all packages that depends on pear, you will need to add pear to repositories section.

{
    "repositories": [
        {
            "type": "pear",
            "url": "https://pear.php.net"
        }

    ],
    "require": {
        "diversen/simple-pager": "^1.3"

    }
}

If you have pear in repositories you can install by doing:

composer require diversen/simple-pager

Example

use diversen\pagination;

// Get a count of rows from a database
// A database query to get the number of rows
// You will need your own way of getting your count of rows
$num_rows = q::numRows('mailer_archive')->fetch();
$per_page = 50;   
     
// Initialize the paginate class, with the total number
// of pages and how many per page. 
$p = new pagination($num_rows, $per_page);

// the rows to display
$rows = q::select('mailer_archive')->
            limit($p->from, $per_page)->
            fetch();

// Display the rows 
foreach($rows as $row) {
    print_r($row);
}
            
// Echo the pager data. 
echo $p->getPagerHTML();

CSS

You can find a CSS example in css/example.css

统计信息

  • 总下载量: 229
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-08-25