Location: PHPKode > scripts > Star Rating System class > star-rating-system-class/articol_mohtml.php
<?php
/*
#################    STAR RATING SYSTEM   ##################
############################################################
CWB PRO			$Name:  $
Revision		$Revision: 1.4 $
Author			$Author: zelteto $
Created 03/01/02        $Date: 2004/01/09 16:07:15 $
Writed by               GraFX (hide@address.com)
Scripts Home:           http://www.grafxsoftware.com
############################################################
File purpose            EXAMPLE WITH FAST TEMPLATE
############################################################
*/

// Please if you integrate into HTML Templates, use this file as example
// You will need to copy all from below into your PHP file ...
// For example if you have picture.php, you will need to copy
// first part and second part of the file on proper place.
// You will need to know some PHP

// STEP 1 - copy from here to PHP file

include_once("config.inc.php");
include_once($RATE_PATH."cls_rate.php");
include_once("cls_fast_template.php");
include_once("$LANG.inc.php");

$ft = new FastTemplate($TEMPLATE_PATH);
$ft->define(array(main=>"template_articol.html"));

//print $rate;
// rate pro changeing
$file=$_SERVER["REQUEST_URI"];

  // version control
  
  
  if(empty($file))
  {
  	global $HTTP_SERVER_VARS;
  	$file=$HTTP_SERVER_VARS['REQUEST_URI'];
  	
  
  }


 $expl=array();
 $expl=explode ("articol.php",$file);
 $file= "articol.php".$expl[1];
 
$file_real=$file;
// specifiing the variables that should be used
// EXAMPLE:
// http://www.domain.com/index.php
// will use as rating string "path/index.php"
// usually we need to rate articles by their id's (and other variables)
// in this case the $var_array should be set up
// if you have Artid then will be
// $var_array = array(0=>"Artid");

  $var_array = array(0=>"id");

// in this case only  http://www.domain.com/index.php?id=1$from=12
// will be rated as "path/index.php?id=1" because the rest of the
// url variables are dumped

// Special case:
// if you want to rate only "path/index.php" but you have some url variables
// then you may leave the array blank

// remove the // from the begining of the next line
// $var_array = array();


$querystring=$_SERVER['QUERY_STRING'];

 // version control
  
  
  if(empty($querystring))
  {
  	global $HTTP_SERVER_VARS;
  	$querystring=$HTTP_SERVER_VARS['QUERY_STRING'];;
  	
  
  }

parse_str($querystring, $variable_array);

// undoing the query string with the  $var_array variables
$buffer="";
foreach(array_keys($variable_array) as $v)
  if(in_array($v,$var_array))
  {
	  $buffer.=$v;
	  $buffer.="=";
	  $buffer.=$variable_array[$v];
	  $buffer.="&";
  }

$buffer=substr($buffer,0, -1);

$file = strtok($file,"?");
if(sizeof($var_array)>0)
{
  $file.="?";
  $file.=$buffer;
}

// END STEP 1

// YOUR CONTENT HERE

// STEP 2

echo "RATE",$rate->getRating();

// END STEP 2
?>
Return current item: Star Rating System class