PHP-Pagination

Simple and lightweight PHP pagination class that works with Twitter Bootstrap perfectly. Manages pagination variables through instantiable class, and markup rendering through view-like include file.

  • 所有者: onassar/PHP-Pagination
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

PHP Pagination

PHP-Pagination contains an instantiable class, along with a view which renders
the pagination markup.

The purpose of this library is to provide a simple API to render pagination
markup, without having to worry about including common files and set too many
settings. With this class, you simply pass in your parameters and make a call to
the instance's *<parse> method.

Pagination Instantiation and Rendering

<?php

    // source inclusion
    require_once APP . '/vendors/PHP-Pagination/Pagination.class.php';

    // set the page number (based on a URL param; cast as an int; ensure min page number)
    $page = $_GET['page'] ?? 1;
    $page = (int) $page;
    $page = min($page, 1);

    // instantiate; set current page; set number of records per page; number of records in total
    $pagination = new Pagination();
    $pagination->setCurrent($page);
    $pagination->setRPP(24);
    $pagination->setTotal(200);

    // grab rendered pagination markup
    $markup = $pagination->parse();

主要指標

概覽
名稱與所有者onassar/PHP-Pagination
主編程語言PHP
編程語言PHP (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2011-07-13 04:05:15
推送於2025-05-18 02:45:35
最后一次提交2025-05-17 22:45:33
發布數0
用户参与
星數125
關注者數7
派生數74
提交數38
已啟用問題?
問題數8
打開的問題數3
拉請求數2
打開的拉請求數3
關閉的拉請求數4
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?