承接 lincsanders/yii_strana_adapter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lincsanders/yii_strana_adapter

Composer 安装命令:

composer require lincsanders/yii_strana_adapter

包简介

Simple Strana adapter for pagination of Yii records

README 文档

README

Yii record adapter for Strana pagination composer package.

Installation

Include the repository and require in your composer.json file:

"require": {
    "lincsanders/yii_strana_adapter": "dev-master",
    ...
}

For more info, see https://packagist.org/packages/lincsanders/yii_strana_adapter

Usage

The usage is a little clunky, but it works. This is essentially a modified version of the "use your own adapter" example straight from https://github.com/usmanhalalit/strana. Substitute "User::model()" with your own stuff.

$strana = new \Strana\Paginator();
$configHelper = new \Strana\ConfigHelper($strana->perPage(5)->getConfig());
$adapter = new YiiStranaAdapter(User::model(), $configHelper);
$paginator = $strana->make(User::model(), $adapter);

This can be used in conjunction with something like the below to create your own paginated search results:

$criteria = new CDbCriteria;

if($_GET['search']){
    $criteria->addSearchCondition('username', $_GET['search']);
}

$model = User::model();
$model->setDbCriteria($criteria);

$strana = new \Strana\Paginator();
$configHelper = new \Strana\ConfigHelper($strana->perPage(5)->getConfig());
$adapter = new YiiStranaAdapter($model, $configHelper);
$paginator = $strana->make($model, $adapter);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-20