Friday, May 27, 2011

Re: Pagination Limits

This is how you can do it:

$this->paginate['Account']['limit'] = 3;
$this->paginate['Account']['order'] = 'RAND()';
$this->paginate['Account']['conditions'] = array();
$this->set('accounts',$this->paginate('Account'));

Replace Account with the model name. Thats how you do it in the
controller. If you want you can skip doing this all the time by
simply declaring $paginate in the app controller. In there you can
list as many paginating default data you want.

I hope its been helpful.

cheers

On May 26, 2:11 pm, Okalany Daniel <dokala...@gmail.com> wrote:
> Hi All,
> i can't seem to be able to limit the number of records returned from cakephp
> pagination.
>
> $this->paginate('limit'=>30);
> limits the number of results per page. But i want to limit the total dataset
> returned. Set it to like 300 since i have a very large table.
>
> regards,
> Daniel

--
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: