Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scharrier/li3_pagination
Lithium pagination that doesn't suck
https://github.com/scharrier/li3_pagination
Last synced: 20 days ago
JSON representation
Lithium pagination that doesn't suck
- Host: GitHub
- URL: https://github.com/scharrier/li3_pagination
- Owner: scharrier
- License: mit
- Created: 2014-01-27T12:45:06.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-17T20:34:47.000Z (almost 10 years ago)
- Last Synced: 2024-10-12T10:45:22.784Z (about 1 month ago)
- Language: PHP
- Homepage:
- Size: 199 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
li3_pagination
==============> I'm sorry, this li3 package isn't still maintained. If someone wants to take the lead, just ping me.
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.It has to be simple. And you know what ? With li3_pagination, it is.
Install
-------The easiest way to install li3_pagination is to use composer, adding this lines in your composer.json file:
```json
{
"require" : {
"scharrier/li3_pagination" : "dev-master"
}
}
```Tell composer to install it :
```
composer install
```And finally, load the library:
```php
// config/bootstrap/libraries.php
Libraries::add('li3_pagination') ;
```Using li3_pagination
--------------------In your model, just use the good trait :
```php
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() :
```php
public function index() {
$records = Records::paginate($this->request, [
'limit' => 20,
'order' => ['field' => 'asc'],
'conditions' => [
'your' => ['custom' => 'conditions']
]
]);
}
```And finally, just call paginate() :
```php
$this->pagination->paginate() ;
```Yep. That's all.
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.