I'm a beginner and struggling to use pagination correctly in cakephp.
The Bakery recommends using this code in the controller. I know its a
dumb question, but do I need to create a function called index() in
order to make this built in helper work ??
<?php
class PostsController extends AppController
{
var $name = 'Posts'; // for PHP4 installs
var $components = array ('Pagination'); // Added
var $helpers = array('Pagination'); // Added
function index() {
$criteria=NULL;
list($order,$limit,$page) = $this->Pagination-
>init($criteria); // Added
$data = $this->Post->findAll($criteria, NULL, $order, $limit,
$page); // Extra parameters added
$this->set('data',$data);
}
}
?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---