I have three tables.
user(id, username, password, email, website)
post (id, title, content, commentCount, timeStamp, AdderID)
comments (userid, postid, comment, timeStamp)
To display all the posts a user has commented on, I am doing the following:
in my site controller:
'comments' = comments::model()->findall($criteria)
in my index
foreach($comments AS $comments): <?php $this->renderPartial('/post/show',array('model'=>$comments->eid)); ?>
$Votes->eid is a relationship defined by:
'eid' => array(self::BELONGS_TO, 'Entry', 'entryid'),
I want to be able to organise the list of posts in different ways. I am able to organise them in relation to time because of the timeStamp on the comments. I want to be able to organise them in relation to the amount of comments a post has. I can’t think of a way to do this.
Does anyone have any ideas on how I could do this? - Or have I just set it up wrong?