Re: Is there a good solution for this?

2008-02-10 Thread MonkeyGirl
Try something like this: $stories = $this-Story-findAll(array('complete' = 0), null, null, null, null, -1); foreach ($stories as $story) { $comments = $this-Story-Comment-findAll(array('story_id' = $story['Story']['id']), 'content', 'created_at DESC', $story['viewablecomments'], null, -1);

Re: Is there a good solution for this?

2008-02-09 Thread duRqoo
AFAIK you can't use variable after LIMIT so u can't get your result set in one call. I would make model function which at first will retrieve visiblecomments number and then use it as value for 'limit' key in options array for find function. On 9. Feb, 03:18 h., freespac [EMAIL PROTECTED] wrote:

Re: Is there a good solution for this?

2008-02-09 Thread MonkeyGirl
I want to return only a number of comments (that is defined in visiblecomments) in every story. This seems like an odd way of doing it, as you'd be able to specify how many comments to retrieve, but not which ones... but yes, it's certainly possible. In your story controller, if your use of

Re: Is there a good solution for this?

2008-02-09 Thread Mech7
Ummm it does give allot of overhead to request all comments and only display a few... especially on a high traffic site. On Feb 9, 8:00 pm, MonkeyGirl [EMAIL PROTECTED] wrote: I want to return only a number of comments (that is defined in visiblecomments) in every story. This seems like an

Is there a good solution for this?

2008-02-08 Thread freespac
I have to tables, stories and comments. They have a relationship story has many comments. comment belongs to story. In stories, I have a field named visiblecomments (yes it's long ;) I want to return only a number of comments (that is defined in visiblecomments) in every story. Example:

Re: Is there a good solution for this?

2008-02-08 Thread Dr. Tarique Sani
On Feb 9, 2008 7:48 AM, freespac [EMAIL PROTECTED] wrote: 2 comments from the first story and 1 comment from the second story. Without having a flag in the comments for visibility I don't think there is a way to return only the visible comments T --