Wednesday, March 30, 2011

Re: Paginate pre-ordered list

@ShadowCross:

Thank you for the help, I appreciate it.

The combination of

> class LikesController extends AppController {
> ...
> var $paginate = array(
> 'limit' => 20,
> ...
> );

AND

> $this->helpers[] = 'Paginator';

while it does in fact load the 'paginator' helper, I'm not quite sure
anything is actually being paginated (I'm a little confused on how it
would). The app also complains that it does not like "$this->limit."
Pagination for the view complains about everything ... count, options,
page, etc.

Using $liked = $this->Like->getMostLiked(10, $this->params['named']
['page']); // Skip loading the paginator and manually set limit
and calling the pages via http://some-site/page:1 ... page:2 ... page:
3 gives me what I want (as I would expect).

So I guess my question is: Should I stick with the above method and
write my own pagination for the view, or am I totally missing the
point entirely on how Cake could handle the pagination for me (which I
would prefer)?

- ED


On Mar 30, 4:07 am, ShadowCross <adri...@jps.net> wrote:
> Oops.  In option 2, the line
>     'conditions' => array('User.id' => $user )));
> should be
>     'conditions' => array('User.id' => $liked[$i] )));

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