Code Examples | Example in controller:
function index() {
$this->Post->recursive = 0;
$this->set('posts', $this->paginate());
}
This allows the Paginator helper to simplify column sorting and
multiple pages of data. Essentially, the paginate() function
performs a find() model function but also analyzes the result and
passes some important pagination parameters to the view. Then, in
the view, the Paginator helper takes those parameters and constructs
multiple pages and column sorting. If the paginate() function is not
run in the controller, the Paginator helper would break in the view. |