fusic/flexlimitpagination 问题修复 & 功能扩展

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

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

fusic/flexlimitpagination

Composer 安装命令:

composer require fusic/flexlimitpagination

包简介

Flexpager plugin for CakePHP

README 文档

README

maintainer: @gorogoroyasu

Installation

composer require fusic/Flexpager

discription

this plugin will help you to create the candidates of pagination. ex)

normal paginator

< prev  1 2 3 4 5 next >

this paginator

< prev 1 2 3 4 5 next> 10 20 100

the "10","20","100" means that the use of your application can change the paginate limit flexibly.

settings

first of all, you have to load the component. and, you have to write "listCandidates" in public $paginate

in controller


public $paginate = [
    'listCandidates' = [10, 20, 100],
    // and more configs.
];
public function initialize()
{
    parent::initialize();
    $this->loadComponent('Flexpager.Flexpager');
}

after that, you have to add this line to AppView.php

public function initialize()
{
    parent::initialize();
    $this->loadHelper('Flexpager.Flexpaginator');
}

usage

in controller (for example in index )

public function index()
{
    $pages = $this->Flexpager->paginate($this->Pages);
    $this->set(compact('pages'));
}

in ctp (for example in index)

<?= $this->Flexpaginator->prev('< '.__('previous')) ?>
<?= $this->Flexpaginator->numbers() ?>
<?= $this->Flexpaginator->next(__('next').' >') ?>
<?= $this->Flexpaginator->limitCandidate() ?>

the method limitCandidate() will return the list of candidates.

if you want to customize the template, you can use the method below.

<?= $this->Flexpaginator->setFlexPagerTemplate('<a class="form-control" href={{url}}>{{content}}</a>') ?>

the args of this method have to include '{{url}}' and '{{content}}'.

the default template is '<a href={{url}}>{{content}}</a>'.

please note that setFlexPagerTemplate method should appear before the method listCandidates.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固