Gotta use model assocations - it makes this sort of thing so much nicer.
http://manual.cakephp.org/chapter/6
Looks like your Comment belongsTo Post, and probably Post hasMany
Comment.
Give the manual a look, and let me know if you have questions on it.
-- J
On May 9, 2006, at 1:47 PM, roberts.sean wrote:
>
> I'm having a similar problem simply trying to add comments to posts.
> I've tried to get a list of comments that would be associated with a
> single post by adding
>
> $this->set('comments', $this->Comment->findAll("WHERE post_id =
> '$id'"));
>
> to the view() function under posts_controller.php but that line
> returns
> "Fatal error: Call to a member function on a non-object". I don't
> fully understand how to go about viewing and manipulating data like
> comments that are fully dependent on posts. I shouldn't have to
> set up
> individual controllers and views for them because I don't want
> users to
> have to go to /comments to view them.
>
> Can anyone give a little insight into this as well as the original
> question?
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---