Fork me on GitHub


To allow for pagination links to easily be created in a view, call $this->set_pagination($collection); using a collection that is returned from a paginate() call on a model.

// controllers/venues_controller.php

class VenuesController extends PublicController {

  public function search() { 
    $collection = $this->Venue->paginate($this->params);
    $this->set('objects', $collection['objects']);

// views/venues/search.php

echo $this->pagination();

set_pagination() processes the collection and sets $this->pagination to an appropriate array that will be used in paginate_links() within $this->pagination(); in the view.