dev-master
9999999-dev http://github.com/scharrier/li3_pagination/Lithium pagination that doesn't suck
The Requires
- php >=5.4
by Sebastien Charrier
pagination paginate lithium li3
Wallogit.com
2017 © Pedro Peláez
Lithium pagination that doesn't suck
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)
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') ;
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)
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)
Lithium pagination that doesn't suck
pagination paginate lithium li3