Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Latest commit

 

History

History
38 lines (28 loc) · 857 Bytes

README.md

File metadata and controls

38 lines (28 loc) · 857 Bytes

Kohana Pagination

There are many like it, but this one is mine.

The default view uses the Bootstrap pagination markup.

Usage

Controller

<?php

# Make sure you have <page> defined in your route (or a different parameter - see Pagination::$route_page_param

...

public function action_user() {
	$users = ORM::factory('users');
	# Add where clause, etc, here if filtering
	$pagination = new Pagination($users, $this->request->param('page'), 'admin_user');
	$this->template->content->pagination = $pagination;
}

View

<?php echo $pagination->render(); ?>

<?php foreach ($pagination->result() as $user): ?>
	Username: <?php echo $user->username; ?><br />
	Email: <?php echo $user->email; ?><br />
	<br />
<?php endforeach; ?>

<?php echo $pagination->render(); ?>