chiliec/yii2-pager

Yii2 分页器

安装次数: 213

依赖者: 0

建议者: 0

安全性: 0

星标: 6

关注者: 5

分支: 4

类型:yii2-extension

2.0 2015-02-01 20:07 UTC

This package is auto-updated.

Last update: 2024-09-06 22:50:10 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

轻量级标记和样式快速上一页和下一页链接,非常适合简单的网站,如博客或杂志。基于 Bootstrap 分页器

用法

<?php
    echo \chiliec\pager\Pager::widget([
        'tableName' => $model->tableName(),
        'currentId' => $model->id, // current primary key
        'path' => 'story/view', // path for link
        // optional fields in most cases
        'primaryKey' => 'id', // name of primary key column
        'title' => 'title', // name of title column
        'additionalСondition' => 'published = 1', // additional SQL-condition
        'cacheTime' => 3600, // time for cache results
        'navOptions' => [],
        'listOptions' => ['class' => 'pager'],
        'prevOptions' => ['class' => 'pull-left', 'rel' => 'prev'],
        'nextOptions' => ['class' => 'pull-right', 'rel' => 'next'],
    ]); 
?>

安装

安装此扩展的首选方式是通过 composer

运行以下命令:

php composer.phar require --prefer-dist chiliec/yii2-pager "~2.0"

或者

"chiliec/yii2-pager": "~2.0"

将以下内容添加到你的 composer.json 文件的 require 部分: