Star Rating Widget

The code below creates a rating widget (or star rater) and a display rater using CSS, JavaScript, and some PHP.

Rating Widgets

The widget is used to quickly collect ratings on a website.
ExampleCode
<?= rater(); ?>
<?= rater(5); ?>
<?= rater(3); ?>
<?= rater(10); ?>

Fixed Raters

Fixed raters can be used to display ratings that cannot be changed.
ExampleCode
<?= fixed_rater(); ?>
<?= fixed_rater(3); ?>
<?= fixed_rater(2,3); ?>

Files Needed

rating_helper.php - contains the two functions demonstrated above.
rating.css - provides the CSS classes used to display the stars as either 'on' or 'off'
rating.js - contains four functions used to change the CSS classes appropriately and to save the clicked ratings into cache

Acknowledgements

The star icon used in the rating widget is available from famfamfam.
Matt Smith 2/20/08