Comments
12 posts by 3 authors in: Forums > CMS Builder
Last Post: August 15, 2011 (RSS)
By design9 - August 3, 2011
I have built a simple comment system for my blogs within CMS. It is a multi section and I have an Name, email and comment field. I also have a hidden field which I use to allow for approval of the comment before it goes live. I have created a form that writes the entered information to the comments table which is on my detail page. All of this works perfectly but here is where I am having an issue.
How can I make the comments show up for a specific category or post? Right now, if I am reading a specific blog post and post a comment, then that comment shows up on all the blogs pages/posts instead of just relating to the individual post that I commented on. Is there an easy way to make comments appear specific to the post?
Here is an example of my details page: http://www.charlotteparent.com/community/blogsnew/details.php?Uproar-Over-CMS-Testing-and-Teacher-Accountability-4 and use can also use the side search options to look at other pages if needed to see how the same comments appear for every post.
Thanks!
April
Re: [design9] Comments
By Jason - August 4, 2011
What you'll probably need to do is to add a cms field where you will store the record numb2er of the blog post that the comment is related to. You can set it as a hidden field inside your form. If you are going to be storing comments from more than 1 section, you'll need to store the table name (in this case "blog") in the CMS as well. That way, when you are retrieving blog comments, you can set the where clause to only retrieve comments with that number.
For example, if your field in "comments" was called "record_number" and you had already selected your blog record ($blog), your query would look like this:
list($commentsRecords, $commentsMetaData) = getRecords(array(
'tableName' => 'comments',
'allowSearch' => false,
'where' => "record_number = '".intval($blog['num'])."'",
));
Hope this helps get you started.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Comments
By design9 - August 9, 2011
Thank you.
I have tried this but something is not working on my end. I have added the hidden field to my form and I called it record_number as you stated in the code.
When I tried to input my table name for the blogs, I get an undefined user error (my blog table name is 'blogs'). When I changed it to the
'".intval($blogsRecod['num'])."' it works but my comments don't appear (after I have approved them in backend, I have them set for approval first).
Can you take a look at my code and see what I am doing incorrectly?
Thanks!
April
Re: [design9] Comments
By Jason - August 9, 2011
Sure, no problem. Please attach all the .php files in question and I'll take a look.
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Comments
Re: [Christopherb] Comments
By Jason - August 11, 2011
Can you give an example of what you would be trying to accomplish?
Let me know and we'll see what suggestions we can make.
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Comments
http://www.interactivetools.com/iforum/gforum.cgi?post=84642;search_string=comments;t=search_engine#84642
and this appears to be similar to what we need.
The additional function we need is to add administrator approval before posting
Thanks!
Re: [Christopherb] Comments
By Jason - August 12, 2011
A way to stop comments from showing up before approval is to use the hidden special field. Create a checkbox in your comments section called hidden (must be lower case). When a comment is added set this checkbox to have a value of 1 (checked). This means it won't appear live until it is unchecked (approved) in the CMS.
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Comments
Just in case this post was overlooked:
When building out a Blog with an open comments area, what is the best method to validate and sanitize end user form input to the CMS Builder database?
Re: [Christopherb] Comments
By Jason - August 12, 2011
Can you give an example of what you mean by "validate and sanitize"? Do you have an INSERT query already set up that you can provide as an example?
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/