Jump to content

Image Rotater :Url Not matching....


chanchelkumar

Recommended Posts

Hi all,

 

Well am trying with an ad rotator, In which image is uploaded and the url is passed through ONClick...

 

But the problem is when it is two images there is no problem, the url is correct, and when we add more than two images the links on images get changed...

 

It will not redirect to the correct link...

please help me...

 

<?php
include "dbconnect.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
@import "style/demo.css";
td { vertical-align:top }
</style>
<script src="dw_rotator.js" type="text/javascript"></script>
<script src="dw_random.js" type="text/javascript"></script>
</head>
<body onload="dw_Rotator.start()">
<?php
//$path_to_images = "advertisement/images/";  // path to your images

// returns string to echo into JavaScript images array 
function getJSRandomized($list, $num,$url) {
    $str = '"';
    mt_srand( (double)microtime() * 1000000 );
    shuffle($list);
    if ( $num == "ALL" ) $num = count($list);
    for ($i=0; $i<$num; $i++) {
        $str .=$list[$i] . '", "';

    }
    // remove last comma and space
    $str = substr($str, 0, -3);
    return $str;
}
?>

<?php
$ct=0;
$wd=$_REQUEST['wd'];
$ht1=$_REQUEST['ht'];
$area=$_REQUEST['area'];
$sel=mysql_query("select * from soccer_banners1 where area='$area' && site='eng'") or die(mysql_error());
while($res=mysql_fetch_array($sel))
{
	if($res['image']=="")
	{
		 $test=$res['html'];
		 $images[$ct]=$test;			
	}
	else
	{
		$test=$res['image'];
		//$ht=$res['url'];
		echo $images[$ct]="admin/banner/".$test;
		$url[$ct]=$res['url'];
	}	
	$ct++;
}	

//echo $url[1];
if ( $image_list =$images ): 
  if ( $url_list =$url ): 
   $num_to_rotate = mysql_num_rows($sel); // number or "ALL" (to rotate all images in directory)

   ?>
<script type="text/javascript">
var imgList1 = [<?php echo getJSRandomized($image_list, $num_to_rotate); ?>];
var rotator1 = new dw_RandRotator(5000,'',true,true); // rotation speed
// images array, width and height of images, transition filter (boolean)
//rotator1.setUpImage(imgList,785,55,false);
rotator1.setUpImage(imgList1,<?=$wd?>,<?=$ht1?>);
//alert ('<?=$imgList1?>');
<?php 
for($k=0;$k<$num_to_rotate;$k++)
{
?>
rotator1.addActions('<?php echo $url_list[$k];?>');
<?php }?>
</script>
<?php // else : ?>
<!-- image to display if directory listing fails >
<img src="images/del.gif" width="88" height="88" alt="">

<script type="text/javascript">dw_Rotator.start = function() {};</script-->

<?php endif; ?>
<?php endif; ?>

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.