Piotr Golasz 2cb2432aaa Pass directory param in Pagination constructor 6 лет назад
..
classes 2cb2432aaa Pass directory param in Pagination constructor 6 лет назад
config b85c698fd4 Module Pagination - приведение к Kohana-codestyle 7 лет назад
views 9aa65e4c6b Started using short array syntax 7 лет назад
README.md 9758bf71d9 Added PSR-0 compatible pagination module 7 лет назад

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.
    */
    Kohana::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