Comments

12 posts by 3 authors in: Forums > CMS Builder
Last Post: August 15, 2011   (RSS)

Re: [design9] Comments

By Jason - August 4, 2011

Hi April,

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

Jason,

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

Hi April,

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

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 11, 2011

Hi,

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

I saw the post
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

Hi,

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

Thanks Jason...

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

Hi,

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/