Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorraslam
    • CommentTimeNov 2nd 2007 edited
     

    paging is not working. $this->post_pages = $this->pagination_helper->getPaginator($this->Post, array('items_per_page' => 5)); $this->posts = $this->Post->find('all', array($this->pagination_helper->getFindOptions( $this->Post ), 'include' => 'member', 'order' => 'posted_at DESC')); there are total of 8 posts and still all show up after setting array('items_per_page' => 5) since there isn't enough documentation on this so I couldn't figure out how to make it work.

    •  
      CommentAuthorbermi
    • CommentTimeNov 2nd 2007
     

    Rashid,

    The method

    $this->pagination_helper->getFindOptions( $this->Post )
    

    returns an array that needs to be merged with the finder options like

    $this->post_pages = $this->pagination_helper->getPaginator($this->Post, array('items_per_page' => 5)); 
    $options = $this->pagination_helper->getFindOptions( $this->Post );
    $options['include'] = 'member';
    $options['order'] = 'posted_at DESC';
    $this->posts = $this->Post->find('all', $options);
    

    I could have used array_merge to make the code shorter, but I think this way might be easier to understand the way the paginator interacts with the finders.

    Regards,

    Bermi

    • CommentAuthorraslam
    • CommentTimeNov 2nd 2007 edited
     

    Thanx Bermi, it worked!!!.

    I tried to figure out what this $this->pagination_helper->getFindOptions( $this->Post ); does but there was no description/detail in API.

Add your comments
    Username Password
  • Format comments as