Tuesday, February 28, 2012

big confusion with 2.x pagination

I'm having some trouble figuring out how pagination has changed. It
appears as if the controller's $paginate array doesn't require any
mods, but I can't get it to properly paginate. The SQL is all correct
except that the offset is not included, so I always get the first page
of results.

Thinking it might be a problem with CakeRequest, I debugged
$this->request->params:

Array
(
[plugin] =>
[controller] => contributors
[action] => index
[lang] => en
[page] => 2

etc.

Is this correct?

The other thing I tried was adding Paginator to the controller's
$components array. The docs are *really* vague on this. Is it
necessary? Because without it, paginate() works (almost--see above) as
expected. But, when I add it to $components, my $paginate array is
completely ignored; associated data is missing, limit is incorrect,
etc. It seems that what would normally go inside $paginate array now
should be in $components under the 'Paginator' key. But, if that's the
case, how come $paginate works otherwise.

So confused. Can someone please clarify? Most importantly, how to pass
the 'page' correctly?

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