Forum Moderators: coopster

Message Too Old, No Replies

Vote and comment script

         

mlduclos

1:45 am on Dec 26, 2005 (gmt 0)

10+ Year Member



Please

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

dreamcatcher

4:01 am on Dec 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try hotscripts.com

[hotscripts.com...]

dc

mlduclos

7:44 am on Dec 26, 2005 (gmt 0)

10+ Year Member



I already visit the pages of hotscript but is not easy to find a survey rating free which can be included in .shtml files. I decide to install 2 scripts, one for comments and other for rating, im trying to find a good solution.

thanks.

barns101

5:18 pm on Dec 26, 2005 (gmt 0)

10+ Year Member



Depending on your level of PHP knowledge, you should be able to knock up a simply voting script fairly easily.

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! :(