PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Er. Rochak Chauhan   AJAX Rating Counter   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: AJAX Rating Counter
AJAX based star rating system
Author: By
Last change: Modified code to enable multiple ratings
Date: 18 years ago
Size: 1,249 bytes


Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
    <html xmlns="" xml:lang="en" lang="en">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Ajax Rating Counter</title>
        <script src="javascript.js" type="text/javascript"></script>
        <style type="text/css">

        .ratingText {
            font-family: verdana;
            font-weight: bold;
            font-size: 16px;
            color: #FFFFFF;
            background-color: #FF0000;
            width: 135px;
     * Example file
    // file/ database to be accessed for rating of 'id'
$file1 = file_get_contents('rating.txt');
$filearray1 = explode(',', $file1);
$rating1 = array_sum($filearray1)/count($filearray1);
// file/ database to be accessed for rating of 'newid'
$file2 = file_get_contents('rating2.txt');
$filearray2 = explode(',', $file2);
$rating2 = array_sum($filearray2)/count($filearray2);
$ajaxRatingCounter = new AjaxRatingCounter();

$ajaxRatingCounter->addStars($rating1, 'id');
$ajaxRatingCounter->addStars($rating2, 'newid');