$this->Model->findAll('criteria','fields','order','yourlimit','page');
this will limit the result queried from the database.
paginate only limit the view in the view layer and it depends on the total record returned by your query.
hope helps
rgds,
Mulianto
On Mon, May 30, 2011 at 5:13 PM, majna <majnaggz@gmail.com> wrote:
Urghhh. Then use paginate callback (found in Controller::paginate()).
Add this in your model:
public function paginateCount($conditions = array(), $recursive = 0,
$extra = array()) {
if (isset($extra['myHardLimit'])) {
return $extra['myHardLimit'];
}
$parameters = compact('conditions');
if ($recursive != $this->recursive) {
$parameters['recursive'] = $recursive;
}
return $this->find('count', array_merge($parameters, $extra));
}
Use in controller:
$this->paginate(array('myHardLimit'=>300,
'condition'=>'Post.published'=>1....));
I think this should work...
On May 30, 8:50 am, Okalany Daniel <dokala...@gmail.com> wrote:
> Thanks. Its not what i was looking for though. I'm looking for a way to
> limit all the records returned by a pagination. Not to limit the records per
> page.
>
>
>
>
>
>
>
>
>
> On Fri, May 27, 2011 at 8:08 PM, majna <majna...@gmail.com> wrote:
> >http://book.cakephp.org/view/1232/Controller-Setup
>
> > On May 27, 3:20 pm, Okalany Daniel <dokala...@gmail.com> wrote:
> > > How would i set the limit in the model? I couldn't find it.
>
> > > 2011/5/26 Alejandro Gómez Fernández <agom...@gmail.com>
>
> > > >
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > 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
> > > > athttp://groups.google.com/group/cake-php
>
> > > --
> > > OKALANY DANIEL,
> > > P.O BOX 26150,
> > > Kampala.,
> > > Uganda.http://okasoft.net
> > > --
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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
> > athttp://groups.google.com/group/cake-php
>
> --
> OKALANY DANIEL,
> P.O BOX 26150,
> Kampala.,
> Uganda.http://okasoft.net
> --
--
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
--
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