Forums Sign Up Reply Search Statistics
Star Rating System GraFX Software Solutions - Forum / Star Rating System /

setting id's for different parts of the page

 
Author Anonymous
Guest
#1 Posted: 17 Apr 2006 04:01:01
Reply 
what do i need to change in here to set id's so i can use the same script for the same index page?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
</head>

<body>
<?php
include_once("config.inc.php");
// rate pro changeing
$file=$_SERVER["REQUEST_URI"];
// version control
if(empty($file))
{
global $HTTP_SERVER_VARS;
$file=$HTTP_SERVER_VARS['REQUEST_URI'];
}
$file_real=$file;
$expl=array();
$expl=explode ("test_html_javascript.php",$file);
if(isset($expl[1]) && !empty($expl[1]))
$file= "test_html_javascript.php".$expl[1];
else
$file= "test_html_javascript.php";

if($file_real!=$file)
{
//end

// 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 ids (and other variables)
// in this case the $var_array should be set up
// remove the // from the begining of the next line
$var_array = array(0=>"id");

// in this case only http://www.domain.com/index.php?id=1".LANG_RATEPRO_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();
$var_array = array(0=>"id");
$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 rate first part

if(substr($file, -1)=="?")
$file=substr($file,0, -1);
}
$file=urlencode($file);
$file_real=urlencode($file_real);
//$js_url="jsrate.php?file=".$file."&file_real=".$file_real;
$js_url="jsrate.php?file=".$file;
?>
<script type="text/javascript" language="javascript" src="<?php print $js_url;?>"></script>
</body>
</html>


and then how do i change it?
Author software
Admin
#2 Posted: 18 Apr 2006 12:39:54
Reply 
Please explain it more better, give us some real examples.
 
Your Reply

» Username  » Password 
Only registered users are allowed to post here. Please enter your login/password details upon posting a message, or sign up first.