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

    I've got some comments that belong to some posts. In the post listning I want to show how many comments a particular post has got. How do I do that?

    This is what I've got so far in the controller:

    $this->posts = $this->Post->find('all', $this->pagination_helper->getFindOptions($this->Post), 
    array('include' => array('category', 'comments')));
    

    Thanks in advance!

    • CommentAuthorKaste
     

    in {loop Posts}

    <?= count($Post->comments) ?>
    

    or:

    <?= $Post->comment->count() ?>
    
    • CommentAuthorKaste
     

    BTW

    $this->Post->find('all', $this->pagination_helper->getFindOptions($this->Post), 
                            array('include' => array('category', 'comments')));
    

    shouldnt work.

    I said array_merge in my post ;-)