PDA

View Full Version : Script like this?



deronsizemore
02-02-2006, 08:51 PM
I'm looking for a basic rating script kinda like ones found here (http://thesis.veracon.net/) and here (http://www.cssreboot.com/)

Is this easily developed or found?

Sean
02-03-2006, 06:42 AM
How I would do the 5-star system (based on my limited skillZ) would be to have a database table with 3 fields (or add fields to a table I'm already using). One to identify what is being rated, one for total points, one for total votes.

For rating I would use a form which, when rated, adds 1 to the total votes field and adds the rating to the total points field.

To display the rating, I would get the total points and total votes integers from the db, divide them ( total points / total votes ), use a function to round the number, and display an image with an amount of stars based on that number.

Would also use something to try to keep people from voting more than once.

For the system that just tallies votes, I'd just get rid of the total points part of the equation and just echo the total votes # straight from the db.

To find a premade one, I'd check out http://hotscripts.com or a similar script site and browse to find one that fits your specifications.

Hope this helps.

deronsizemore
02-03-2006, 06:25 PM
How I would do the 5-star system (based on my limited skillZ) would be to have a database table with 3 fields (or add fields to a table I'm already using). One to identify what is being rated, one for total points, one for total votes.

For rating I would use a form which, when rated, adds 1 to the total votes field and adds the rating to the total points field.

To display the rating, I would get the total points and total votes integers from the db, divide them ( total points / total votes ), use a function to round the number, and display an image with an amount of stars based on that number.

Would also use something to try to keep people from voting more than once.

For the system that just tallies votes, I'd just get rid of the total points part of the equation and just echo the total votes # straight from the db.

To find a premade one, I'd check out http://hotscripts.com or a similar script site and browse to find one that fits your specifications.

Hope this helps.


Thanks! Althought most of what you said went right over my head. ;)

I've breifly looked at hotscripts, but I'll go back and check it out again to see what I can find. I'm no programmer at all...so doing more or less everything you said in the first part of your message is out of the question.

Thanks a lot.

dc dalton
03-02-2006, 04:13 PM
That first one is nicely done! Very nicely done.

They are using AJAX (IE: XMLHttpRequest) to communicate with a backend database to log the votes.

Plain and simple when you click on it it sends the layout id you clicked on back to a php app which then updates the database. Using this type code the page doesnt have to reload to do these type things.

The only real downside to this is if they have Javascript disabled (the front end of AJAX is javascript driven) ... but if they do a lot more of the web than this doesn't work.

Don't know of any premade script for this off the top of my head, most the free rating scripts are those stupid "hot or not" scripts.