Commenting system for CakePHP blog tutorial
Posted
by Ryan
on Stack Overflow
See other posts from Stack Overflow
or by Ryan
Published on 2010-06-03T01:03:25Z
Indexed on
2010/06/03
8:24 UTC
Read the original article
Hit count: 189
cakephp
I'm building off the CakePHP tutorial for the blog engine by adding comments to each post. I am able to add comments by selecting the post that it should be attached to, via a select box. I would like to be able to click an "Add Comment" link within the post and have the association to the post formed programatically. I am unsure how I can pass the post_id to the add method within my comments_controller. The body of my add method is the auto-generated scaffold code. Is it as easy as adding a $postId argument to the add method and write this to the post_id in my comments model? This doesn't feel right though, since I would expect add to be called when my submit button is click on my comments add view.
Thanks all.
© Stack Overflow or respective owner