2017 © Pedro Peláez
 

library li3_pagination

Lithium pagination that doesn't suck

image

scharrier/li3_pagination

Lithium pagination that doesn't suck

  • Wednesday, December 17, 2014
  • by scharrier
  • Repository
  • 1 Watchers
  • 3 Stars
  • 139 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

li3_pagination

I'm sorry, this li3 package isn't still maintained. If someone wants to take the lead, just ping me., (*1)

Lithium doesn't suck. This is a fact. But hey, what's about pagination ? Not natively included in the framework, all the existing plugins are just wrong. Pagination is a really common thing : we, developers, have to paginate everything, everytime., (*2)

It has to be simple. And you know what ? With li3_pagination, it is., (*3)

Install

The easiest way to install li3_pagination is to use composer, adding this lines in your composer.json file:, (*4)

{
    "require" : {
        "scharrier/li3_pagination" : "dev-master"
    }
}

Tell composer to install it :, (*5)

composer install

And finally, load the library:, (*6)

// config/bootstrap/libraries.php
Libraries::add('li3_pagination') ;

Using li3_pagination

In your model, just use the good trait :, (*7)

class MyModel extends \lithium\data\Model {

    use \li3_pagination\extensions\data\Paginable ;

}

The trait add a method paginate() to your model. Now, call it directly from your controller instead of a standard find() :, (*8)

public function index() {
    $records = Records::paginate($this->request, [
        'limit' => 20,
        'order' => ['field' => 'asc'],
        'conditions' => [
            'your' => ['custom' => 'conditions']
        ]
    ]);
}

And finally, just call paginate() :, (*9)

$this->pagination->paginate() ;

Yep. That's all., (*10)

Help and support

Fork it, play with it, commit if needed and pull request ! Ask your questions or tell me more about problems you have in the repo issues., (*11)

The Versions

17/12 2014

dev-master

9999999-dev http://github.com/scharrier/li3_pagination/

Lithium pagination that doesn't suck

  Sources   Download

The Requires

  • php >=5.4

 

by Sebastien Charrier

pagination paginate lithium li3