Not found
The requested address was not found on this server.

This usually indicates that either mod_rewrite is not working or you
have fiddled with your paths in config/core.php

As for getting all the comments that belong to a post

Post hasMany Comments

$data = $this->Post->read($postId);

Then you will have $data['Post'] and $data['Comments] at you
fingertips.  The comments will be $data[Comments'][{n}][fieldName]
format so you can loop over them easy enough.

When creating a comment you will need to know the post id before hand
(usually as a hidden form field).

Geoff
--
http://lemoncake.wordpress.com

On Aug 3, 11:24 am, Dan Soendergaard <[EMAIL PROTECTED]> wrote:
> Hi bakers!
>
> I have just recently begun using CakePHP, and I'm already convinced
> that's it's great! As my first project I followed the CakePHP Blog
> tutorial in the Manual. It works just fine, but I'd like to also add
> comments to my "blog". I've searched for a tutorial or tip on how to
> do this, but have so far been unable to find anything useful.
>
> As a start I added a 'comments' table to my database. Each comment has
> an id, author, content and post-id. I also created views for index,
> add and view (although I'd only need index and add, right?). I then
> created comments_controller.php and my comment model.
>
> It all looks all right but when I browsehttp://mydomain.com/cake/comments/
> I get a:
>
> Not found
> The requested address was not found on this server.
>
> So first question is, why?
>
> When I can view comments, how do I link them to a post? Usually, I
> would write a query like this:
>
> SELECT author, content, date FROM comments WHERE post = $post_id
>
> After reading some more documentation I found out that I could do this
> in my comments_controller.php:
>
> function index($id)
> {
>    $this->set('comments', $this->Comment->findAll('post = ' . $id));
>
> }
>
> But... because of my first problem I can't really check the result. Am
> I in the right direction?
>
> Thanks in advance!
>
> Regards,
>
> Dan


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to