Hi, I've got a website (just a static HTML site) but I think I've got a few MySQL databases available to use on my web hosting package, and can use PHP. I'm just wondering, is there a way of adding a comments section to the pages of my website? So at the bottom of my articles people can just post a comment? Would PHP be the best way to do this? Thanks for any help
Yes. This is possible, but after programming you need to store all your articles in the database and because it's html files you need to use .htaccess to convert the script to HTML. Good Luck.
Definitely, PHP would be perfect for something like this. The way I'd go about it is setting up a table for all of my articles, where each one has it's own unique id. Then, create a separate table for storing comments, and have the comment row store the article id it's meant for. The comment form would be at the bottom of each article, and you can store the id for that article in a hidden input on page. Then when someone submits a comment, your script will get all of their input along with the id of the article, and insert the new comment row.
I think that it's better to use open source CMS to manage your articles. Then it will be easy to add a comments section........and....other functions.
This is true. Could import it all into a Drupal or Wordpress or such like. Would have commenting enabled too
Thanks for all the help. When I said can PHP do this, I was meaning is this the best/easiest way of doing it? Or are there other, simpler ways? Thanks again
No. I'd say PHP is the way to go. If you have no programming experience, I'd recommend using a script, though.
Or you could even use the comment system from Google with your html pages. That way you won't have to bother about coding etc http://www.google.com/friendconnect/
Sorry guys one more point I forgot to add - I'm hoping to make it as SEO friendly as possible, i.e. I want to add a comments section to every page not only because I want users to be able to instantly leave feedback/ask questions but also because I want this to be seen as new, unique content and to show that people read my site (and hopefully the search engines will like this aspect). Just thought I would say that incase some methods of adding a comment system are more SEO friendly then others? Thanks
The easiest programming language to do this imo is PHP with MYSQL. Each entry in the table comments would link to an article id, which can be referenced in the articles table. Then if comment id == current article id, display it! Although if you are looking for a plug and play solution, you can obviously use something like WordPress. As for the SEO factor, if you can view the source of your page, and the comments are clearly there in the HTML than the Search Engine can see them. Factors that might affect this are some pagination scrips, meaning the SE doesn't see all of the comments, only the 1st page, or if it is using some funky JS to output the data for some reason.
I wish comments worked like that. I just get spam and idiots. :-P As far as the "easiest" way to implement this goes, You could make a script to include at the bottom of your pages. This script would store and retrieve comments in a database table by the URL of the page the script was included to. Which means you wouldn't have to manually enter every page you wanted comments on into a database. Is it a little janky? Yes. But it's easy and it works pretty well. Add a captcha if you want to avoid all the spam.
Or an extra field with a simple maths sum or something! Change this to an image or different questions if you find somehow spam is getting through.
Using PHP to implement this, you could have say a table named articles and one named comments, in comments you would have aid (article id), and text, user etc. Then all you would do is "SELECT * FROM `comments` WHERE aid='".$aid."', and $aid = $_GET['article'] or whatever the GET used would be.
God, I remember when I first started out and I wanted a comment script. I searched high and low for what I was looking for and couldn't find them. Thank god I learned PHP and MySQL haha. If you know PHP you could look for a script and edit it or ask someone for one.
Visit this link http://demo.koolphp.net/Examples/KoolAjax/UpdatePanel/Ajax_Comment_Post/index.php Its a very nice commenting system that uses ajax. its very nice and useful. have a look.