Login   Register  
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arturs Sosins  >  Star rating  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Star rating
Display and submit star ratings
Author: By
Last change: credits changed
Date: 2011-04-25 12:34
Size: 1,727 bytes
 

Contents

Class file image Download
<!--
/*************************************************************
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
 * Fee free to distribute and modify code, but keep reference to its creator
 *
 * Star rating class can be used to display rating using empty and full star graphics 
 * (user defined or default package graphic) and allow visistors to rate items 
 * from 1 to user defined value, by displaying full/empty stars on mouse movement 
 * and passing value through get or post
 *
 * For more information, examples and online documentation visit: 
 * http://webcodingeasy.com/JS-classes/Star-rating-class
**************************************************************/
--><?php
print_r($_POST);
?>
<html>
<head>
</head>
<body>
<!--- Display rating --->
<p>Display rating: </p>
<div id='rating'></div>
<!--- Rate item --->
<p>Rate item: </p>
<div id='rate_star'></div>
<script type="text/javascript" 
	src="./star_rating.packed.js" ></script>
<script type="text/javascript">
//create rating instance
//parameter json with configuration values
var rate = new star_rating(
	{
		/*********************
		 * Example of configuration 
		 * options and default values
		 *********************/
		//maximal rating(value greater than 0)
		max: 5,
		//graphic for empty star
		graphic_empty : "./empty.png",
		//graphic for full star
		graphic_full : "./full.png",
		//how to send data (possible values: post, get)
		send_type : "post"
	}
);
//creating ratable element
//parameter id of an element
rate.rate_item("rate_star");
//display rating
//parameter id of an element
rate.display_rating(2.5, "rating");
</script>
</body>
</html>