Forum Moderators: coopster
Do you know a good (and free) script for add in each article page of the site? The script should have a vote system for the article and allow comments. My site use SSI and can include a PHP script at the bottom of the page. A admin area too add/edit polls and comments is desirable. Im searching but I find only vote or only comments scripts.
Thanks in advance
Assuming that all of the articles are databased with an ID number, all you need to do is create a new table on your database for the votes, with fields similar to this:
------------------------------------------
¦ articleID ¦ number_votes ¦ total_score ¦
------------------------------------------
¦ 1 ¦ 4 ¦ 20 ¦
------------------------------------------
¦ 2 ¦ 1 ¦ 3 ¦
------------------------------------------
...
When a new article is added, add a row to the votes table above with the article ID filled in and number_votes and total_score set to 0. Then when somebody votes (let's say a score out of 5) you simply update the table based on the article ID, add 1 to number_votes and increase total_score by the vote cast. You can then extract an average score by dividing total_score by number_votes.
I hope this is useful. May not be the most elegant solution but should be simple to set up. :)
EDIT: Sorry, can't get attempt at table schema to line up! :(