aweitian/pagination 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

aweitian/pagination

Composer 安装命令:

composer require aweitian/pagination

包简介

简单分页组件

README 文档

README

$page = new Pagination(110, 2, 7, 5);

<?php print "total:   {$page->getCurPageNum()} / {$page->getMaxPage()}   ";?>

<?php if ($page->hasPre()):?> 
    <a class="pre" href='?page=<?php print $page->getPre()?>'>
        << <?php print $page->getPre()?>
    </a>
<?php endif;?>

<?php for ($i = 0; $i < $page->getPageBtnLen(); $i++) :?>
    <a href='?page=<?php print $page->getStartPage() + $i?>' class='<?php if($page->getStartPage() + $i == $page->getCurPageNum()):?>current<?php endif?>'>
        <?php print $page->getStartPage() + $i?>
    </a>
<?php endfor;?>


<?php if ($page->hasNext()):?> 
    <a class="next" href='?page=<?php print $page->getNext()?>'>
        >> <?php print $page->getNext()?>
    </a>
<?php endif;?>

ellipsis

<?php if ($page->hasEllipsis()): ?>
    <?php $i = 1; ?>
    <a<?php if ($i == $page->getCurrent()): ?> class="current"<?php endif ?> href="?<?php $tmp_get = $_GET;
    $tmp_get['page'] = $i;
    print http_build_query($tmp_get) ?>">
        <?php print $i ?>
    </a>
    <?php if ($page->hasPreEllipsis()): ?>
        <a>...</a>
    <?php endif ?>
    <?php for ($i = $page->getStartNum(); $i <= $page->getRearNum(); $i++): ?>
        <a<?php if ($i == $page->getCurrent()): ?> class="current"<?php endif ?> href="?<?php $tmp_get = $_GET;
        $tmp_get['page'] = $i;
        print http_build_query($tmp_get) ?>">
            <?php print $i ?>
        </a>
    <?php endfor ?>
    <?php if ($page->hasRearEllipsis()): ?>
        <a>...</a>
    <?php endif ?>
    <?php $i = $page->getTotal(); ?>
    <a<?php if ($i == $page->getCurrent()): ?> class="current"<?php endif ?> href="?<?php $tmp_get = $_GET;
    $tmp_get['page'] = $i;
    print http_build_query($tmp_get) ?>">
        <?php print $i ?>
    </a>

<?php else : ?>
    <?php for ($i = 1; $i <= $page->getTotal(); $i++): ?>
        <a<?php if ($i == $page->getCurrent()): ?> class="current"<?php endif ?> href="?<?php $tmp_get = $_GET;
        $tmp_get['page'] = $i;
        print http_build_query($tmp_get) ?>">
            <?php print $i ?>
        </a>
    <?php endfor ?>
<?php endif; ?>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固