Tobias Oitzinger 4ef4973cfd Move koseven.ga to koseven.dev | 4 лет назад | |
---|---|---|
.. | ||
classes | 4 лет назад | |
config | 7 лет назад | |
views | 5 лет назад | |
README.md | 4 лет назад |
Pagination module for Koseven
Enable the module in your bootstrap file:
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
KO7::modules(array(
// ...
'pagination' => MODPATH.'pagination',
// ...
));
Make sure the settings in config/pagination.php
are correct for your environment. If not, copy the file to application/config/pagination.php
and change the values accordingly.
class Controller_Products extends Controller_Template
{
public function action_index() {
$products_count = ORM::factory('Product')->count_all();
$pagination = Pagination::factory(array(
'total_items' => $products_count,
'items_per_page' => 20,
));
$products = ORM::factory('Product')
->limit($pagination->items_per_page)
->offset($pagination->offset)
->find_all();
$content = View::factory('index/v_products')
->set('products', $products)
->set('pagination', $pagination);
}
}
This package is open-sourced software licensed under the BSD license