1 March 2007


css_rating is a Ajax rating system for Textpattern based on Unobtrusive AJAX Star Rating Bar


  • uses CSS for voting bar
  • IP limiting
  • scalable voting bar 1 to 10 units
  • uses Ajax

Usage and Tags

<txp:css_rating_bar /> is used to draw voting bar

  • id: default is current article id (uses $thisarticle[‘thisid’]) and most of the cases you don’t have to specify this. If you want to show rating bar for a diffent article find its article id on articles list. e.g. on index: vote for my awsome “AAA Titled” article <txp:css_rating_bar id="x" /> where “x” is my “AAA Titled” article id (integer)
  • units: number of rating units you want to use, default is 10. 10 is upper limit.
  • unitwidth: Width of a rating unit in pixel, default is 30. Note that unitwidth is not used for styling, in rating.css default value 30px used so if you change it you shoul edit the rating style sheet
  • firstvote: Give your fist vote for all articles, default 7

<txp:css_rating_js /> is used for neccesary javascript and css files. This should be placed in <head> </head> tags

  • js: default is empty, it used for uploaded .js file id


  1. Upload css_rating_sql.php and rating.php to your Textpattern directory. (You can skip this see 8)
  2. Upload 2 images in images folder to images directory.
  3. Upload the rpc.php to root directory (it handles ajax requests)
  4. Go to css_rating_sql.php e.g. http://www.yoursite.com/textpattern/css_rating_sql.php
  5. Delete css_rating_sql.php when you get the success message
  6. Install css_rating
  7. Upload the rating.js file in files folder via Textpattern interface or directly to files folder.
  8. Creating Rating MySQL table (Optional, skip this if you do 1. step) Following table is used for rating data you can run this sql code via phpMyAdmin
    CREATE TABLE IF NOT EXISTS `txp_ratings` ( `id` int(10) unsigned NOT NULL, `total_votes` int(10) unsigned NOT NULL, `total_value` int(10) unsigned NOT NULL, `used_ips` longtext NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM;


css_rating.zip 12 KB


<txp:css_rating_bar id="84" units="8"/>

Rating: 6.0 (541 votes)

<txp:css_rating_bar id="80" units="5" />

Rating: 4.0 (438 votes)

Comments [61]