Forum Moderators: mack

Message Too Old, No Replies

Comments System on Existing Website

looking for an easy way to add comments to HTML pages

         

Garden Variety

3:34 pm on Aug 13, 2007 (gmt 0)

10+ Year Member



I have an existing website with several hundred HTML pages on a group of topics. Each topic spans several pages, i.e., topic "A" is on pages A1, A2, A3, etc., and topic "B" on B1, B2, B3, etc.

I would like to make the website more "interactive" by giving users a chance to comment. Ideally, I would like to add a comment page to every topic. (Instead of having a separate discussion forum section.) For example, the comments might always be page "10", so the comments page for topic "A" would page A10, and the comments for topic "B" would be B10, etc.

Can anyone recommend a script, a php something or other, that would allow me to create many comment pages, one for each topic?

My webhost has numerous content management applications that can be installed easily. (I have aleady installed a blog on another website in this way.) But when I read the description of what these programs do I can't make out whether or not they meet the needs I describe above.

Any ideas?

mack

1:42 am on Aug 14, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Because the pages are static HTML pages this does make the issue slightly more complicated. The first issue we need to address is being able to use scripting within your existing documents.

As an example you may with to use a php/mysql script to enable commenting. What you need to do is trick your server into parsing the existing documents as php.

What you can do is create a file called .htaccess at your websites root level. You may already have one there, you would be best to check before you over write it. Within the .htaccess file add the following...

AddType application/x-httpd-php .php .html

This will allow you to execute php code from within html pages.

The .htaccess file needs the "." dot before htaccess

What I would do now is give every existing page a unique numerical value, you can then specify this value within every page. Use something like the following...

<?php $pagevalue = "x" ;?>

where x is a unique number for every page...

Then within your mysql database you woudl have a column for page value... this will allow you to only show comments that are related to a specific page.

What I woudl do is have a short form on the page that a user can use to add comments. The form woudl point to a simple php script that woudl use mysql insert to add the comment to the database. All you would need to add are title and comment.

Below the form you could then use mysql select to gather, then print the existing comments.

Hope this gives you some ideas.

Mack.

Beagle

11:16 pm on Aug 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you don't expect the comments for each individual page to be terribly extensive, there are comment scripts that work with an individual flat file database for each page instead of a more complex one for the entire site. What I've seen have been php, but there are some that provide adaptation for html pages. Because each time you drop in the code it makes a stand-alone comment application, there's no integration among the various pages, and it's not as flexible a solution as a site-wide database. But if that sounds like a workable solution for you, check out comment scripts on your favorite scripts site and look for "flat file".