PHP Classes

AJAX Rating Counter: AJAX based star rating system

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 57%Total: 7,760 This week: 2All time: 228 This week: 23Up
Version License PHP version Categories
ajaxratingcounter 1.0.0Free for non-comm...4Content management, AJAX
Description 

Author

This package can be used to implement a star rating system that uses AJAX to update the average rate without reloading the rate page after a user has voted.

It can display the current average rating between 1 to 10 using star icon images.

A new rating submitted by an user is sent to the server using an AJAX request. The server returns the updated rating average and the star icon images change to the new rating value.

Picture of Er. Rochak Chauhan
  Performance   Level  
Name: Er. Rochak Chauhan is available for providing paid consulting. Contact Er. Rochak Chauhan .
Classes: 54 packages by
Country: India India
Age: 46
All time rank: 21 in India India
Week rank: 15 Down1 in India India Equal
Innovation award
Innovation award
Nominee: 15x

Winner: 4x

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <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;
        }
        </style>
    </head>
<body>
<?php
   
/**
     * 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);
   
   
    require_once(
'AjaxRatingCounter.inc.php');
   
$ajaxRatingCounter = new AjaxRatingCounter();

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

</body></html>


Screenshots (1)  
  • screenshot.jpg
  Files folder image Files (13)  
File Role Description
Accessible without login Plain text file ajax.php Aux. Back end file
Plain text file AjaxRatingCounter.inc.php Class Main Class
Accessible without login Image file even1.jpg Icon Image
Accessible without login Plain text file example.php Example Example file
Accessible without login Plain text file javascript.js Data javascript File
Accessible without login Image file odd1.jpg Photo Image
Accessible without login Plain text file rating.txt Data rating counter dbase
Accessible without login Plain text file rating2.txt Data rating file
Accessible without login Image file _even1.jpg Icon Image
Accessible without login Image file _odd1.jpg Icon image
Accessible without login Image file __even1.jpg Icon image
Accessible without login Image file __odd1.jpg Icon Image

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:7,760
This week:2
All time:228
This week:23Up
 User Ratings  
 
 All time
Utility:84%StarStarStarStarStar
Consistency:77%StarStarStarStar
Documentation:-
Examples:78%StarStarStarStar
Tests:-
Videos:-
Overall:57%StarStarStar
Rank:1591