I am a new-fish of the CAKEPHP and want to take advantage of the
PaginatorHelper and PaginatorComponent, and added this function to the
blog app which appeared in the cakephp document's tutorial, but I
come across some problems:
My class PostsController likes below and it works(every page shows 2
records, while the database's posts table has 3 records):
class PostsController extends AppController{
public $name = 'Problems';
public $helpers = array('Html','Form','Paginator');
public $components = array('Session','Paginator' =>
array('settings' => array('maxLimit'=>1)));
public $paginate = array(
'limit' => 2,
'maxLimit' => 2,
);
public function index(){
$data = $this->paginate('Post');
$this->set('posts',$data);
}
}
the question is if I replace the $components by this: public
$components = array('Session','Paginator'); (remove the settings
array), then the page shows all the 3 records(the $paginate dose not
work at all!)
I don't know why the var $paginate does not work, and follow the
document's Pagination section, I want add a conditions to the paginate
but it does not work.
How to solve this problem?Thank you.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment