Re: How do I display all comments for a post.

2011-03-31 Thread Tilen Majerle
foreach ($posts as $post) //main foreach for displaying posts { ///somewhere where you want comments do this foreach ($post['Comment'] as $comment) { pr($comment); } } -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/3/31 Elguapaul > I have 2 tables, posts and comments.

How do I display all comments for a post.

2011-03-31 Thread Elguapaul
I have 2 tables, posts and comments. I have setup posts hasMany comments and comments belongsTo posts model relations. I am using a foreign key in the comments table pointing back to the post id. I want to display the Post and the all related comments. At the moment I can display the post and a