2017 © Pedro Peláez
 

library yii_strana_adapter

Simple Strana adapter for pagination of Yii records

image

lincsanders/yii_strana_adapter

Simple Strana adapter for pagination of Yii records

  • Friday, February 20, 2015
  • by lincsanders
  • Repository
  • 1 Watchers
  • 0 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 10 % Grown

The README.md

YiiStranaAdapter

Yii record adapter for Strana pagination composer package., (*1)

Installation

Include the repository and require in your composer.json file:, (*2)

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

For more info, see https://packagist.org/packages/lincsanders/yii_strana_adapter, (*3)

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., (*4)

$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:, (*5)

$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);

The Versions

20/02 2015

dev-master

9999999-dev

Simple Strana adapter for pagination of Yii records

  Sources   Download

MIT

The Requires

 

by Lincoln Sanderson

yii pagination cactiverecord strana