Jump to content

? mark in popup page..


kishan

Recommended Posts

iam getting a ? in the pop up page Y can u pls clearify...

 

iam using the smarty template ...

 

This is My tpl file

 

<html>
<head>
<style>
  body{background-color:#DBE8F1; border:1px solid #6982A1;}
</style>

<script language="javascript">
//disable the F5(refresh) Key..
document.onkeydown=function(){
/*var eve=window.event?window.event:e;   
var keyval=window.event?window.event.keyCode :e.which;   
  if (keyval==116){	
eve.returnValue = false;
eve.keyCode = 0;	
*/	
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rate the video aaa</title>
</head> 
<form name='rateform' method="post">
<body id='rate_body'>
  <table width="100%" cellspacing="0" cellpadding="0">
	<tr>
	<td valign="top">	
	 <ZONE rating enabled>
   		    <a href='javascript:window.close();' style="text-decoration:none"><font color='#7B7EB0'>close</font></a>
            <h1 style="color:#002D67"><strong>Rate this video</strong></h1>
       		 <br />            
		<input type="radio" id='rate'  name="rate" value="1"/>
            <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /><br/>
            <input type="radio"  id='rate' name="rate" value="2"/>
            <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" /><br/>
            <input type="radio"  id='rate' name="rate" value="3"/>
            <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /><br/>
            <input type="radio"  id='rate' name="rate" value="4"/>
            <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /><br/>
            <input type="radio" id='rate' name="rate" value="5"/>
            <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /> <img src="theme/default/images/frame/bk_star.gif"  id="rate_btn" alt="star" /><br/>
        <br/>
            <center>
              <input name="submit" type="submit" id="submit"   value="Vote" />
            </center>
          </ZONE rating enabled> 
	  <ZONE rating disabled>          
	   <script language='javascript'>document.getElementById('rate_body').style.border='0px';</script>
	  <table>
            <tr>
              <td><strong><font color='#7B7EB0'>Thank you for rating  this video:</font></strong></td>
            </tr>
            <tr>
              <td> </td>
            </tr>
            <tr>
              <td style="color:#002D67"><strong>No Of Rates:<span id='no_of_rates'> {rate.hits}</span>                   
              </strong></td>
            </tr>
            <tr>
              <td style="color:#002D67"><strong>Overall rating:<span id='rate_avg' style="color:#FF0000">{rate.avg}/5</span>           </strong></td>
            </tr>
            <tr>
              <td> </td>
            </tr>
            <tr>
              <td><strong><a href='javascript:window.close();' style="text-decoration:none"><font color="#9C47AC">close this window</font></a></strong></td>
            </tr>
          </table>
        </ZONE rating disabled>   
       </td>
   </tr>
   </table>
    </body>
</form>
</html>

 

 

 

And this is my php..

 

 

 

 

<?php
/* Check Structure Availability */
if (!defined("CORE_STRAP")) die("Out of structure call");	
// TEMPLATE HANDLING //////////////////////////////////////////////////////////////////

$tpl = new template;
$tpl -> Load("rate_popup");
	//LOAD AND ASSIGN VIDEO 

if(isset($_POST['submit']))	
  {
	if (isset($_GET["id"])) 
		$row = myF(myQ("
			SELECT * 
			FROM `[x]video` 
			WHERE `id`='{$_GET["id"]}' 
			AND `processed` = '1'
		"));
	elseif (isset($_GET["cat"]))
		$row = myF(myQ("
			SELECT * 
			FROM `[x]video` 
			WHERE `category` = '{$_GET["cat"]}' 
			AND `processed` = '1'
			ORDER BY RAND() 
			LIMIT 1
		"));
	else
		$row = myF(myQ("
			SELECT * 
			FROM `[x]video` 
			WHERE `processed` = '1'
			ORDER BY RAND() 
			LIMIT 1
		"));

	// COMPUTE RATINGS ///////////
	if (!is_array($rating = unpk($row["rating"]))) $rating = array();		
	if (me("id") > 0 and in_array(me("id"), array_keys($rating))) $tpl -> Zone("rating", "disabled");
	else {	
		if (isset($_POST["rate"]) and $_POST["rate"] > 0 and $_POST["rate"] < 6 and is_numeric($_POST["rate"]))
		 {			
			$rating[me("id")] = $_POST["rate"];			
			myQ("
				UPDATE `[x]video` 
				SET 
					`rating`='".pk($rating)."',
					`rating_hits`='".count($rating)."',
					`rating_avg`='".round(array_sum($rating) / count($rating), 1)."'
				WHERE `id`='{$row["id"]}' 
				LIMIT 1
			");
		 $GLOBALS["CHROMELESS_MODE"] = true;		
		 $imgno=round(array_sum($rating) / count($rating), 1);
		 //changing the rate image when assigning a rate in pop-up...
		 echo "<script language='javascript'>window.opener.document.images['rate_img'].src='theme/default/images/frame/$imgno.gif';</script>";
		 $tpl -> zone('rating','disabled');		 		 
		 $tpl -> AssignArray(array(
			"rate.hits" => count($rating),
			"rate.avg" => round(array_sum($rating) / count($rating), 1)
			));
		 $tpl -> Flush();
		 die();
		}
	}

	$tpl -> AssignArray(array(
		"rate.hits" => count($rating),
		"rate.avg" => (count($rating) > 0 ? round(array_sum($rating) / count($rating), 1) : 0)
	));

	// Update video data; views count 
	if (!isset($_SESSION["video_view"]) or (isset($_SESSION["video_view"]) and $_SESSION["video_view"] != $row["id"])) {
		myQ("UPDATE `[x]video` SET `views` = `views` + '1' WHERE `id`='{$row["id"]}'");
		$_SESSION["video_view"] = $row["id"];
	}  		
   } //end of submit..	
  else
     $tpl -> zone('rating','enabled');   


$tpl -> CleanZones();
$tpl -> Flush();
?>

 

(edited by kenrbnsn to put in the


tags)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.