Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorraslam
     

    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
     

    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
     

    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.