Tobias Oitzinger 4ef4973cfd Move koseven.ga to koseven.dev 4 years ago
..
classes 4ef4973cfd Move koseven.ga to koseven.dev 4 years ago
config b85c698fd4 Module Pagination - приведение к Kohana-codestyle 7 years ago
views 9b0abb927e Replace all uses of __() to I18n::get in MODPATH 5 years ago
README.md 4ef4973cfd Move koseven.ga to koseven.dev 4 years ago

README.md

Koseven - pagination module

Pagination module for Koseven

Getting Started

  1. Enable the module in your bootstrap file:

    /**
    * Enable modules. Modules are referenced by a relative or absolute path.
    */
    KO7::modules(array(
    // ...
        'pagination'       => MODPATH.'pagination',
    // ...
    ));
    
  2. 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.

Usage


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

License

This package is open-sourced software licensed under the BSD license