There is almost no difference between the paging mode of Kohana3.3 and the previous version, but it seems that the Kohana framework does not bring the Paginationmodule by default. you can click here to download it. Step 1: enable the paging mode in bootstap. php.
There is almost no difference between the paging of Kohana 3.3 and the previous version, but it seems that the Kohana framework does not bring the Pagination module by default. you can click here to download it.
Step 1: enable the paging module in bootstap. php:
Kohana::modules(array( 'pagination' => MODPATH.'pagination', ));
In the controller, you can write as follows:
/** By www.phpddt.com */public function action_view () {$ articles = ORM: factory ('article')-> join ('Category ')-> on ('article. cid ',' = ', 'Category. id '); $ pager = Pagination: factory (array ('total _ items' => $ articles-> count_all (), 'items _ per_page '=> 4, 'First _ page_in_url '=> TURE,); $ data ['articles'] = $ articles-> offset ($ pager-> offset) -> limit ($ pager-> items_per_page)-> find_all (); $ data ['pager'] = $ pager; $ this-> _ title ('Article list '); $ this-> _ render ('_ body', $ data, 'Test/list ');}
I have rewritten the Kohana view rendering and variable passing, so you can see the code above, as long as you pay attention to the use of paging:
$pager = Pagination::factory(array( 'total_items' => $articles->count_all(),'items_per_page' => 4, 'first_page_in_url' => TURE, ));
This paging class is super simple. for specific configuration parameters, see the source code, and then in the view:
Serial Number |
Title |
Category |
Content |
$ A):?>
Aid?> |
Title?> |
Cid?> |
Content?> |
|
:
Download Pagination module (by www.phpddt.com#.rar)