Edit by wumingsden: next time you post pieces of code please place them in the "code" tags. If the code is long, like the stuff below, then please use www.pastebin.com (it is currently down which is why I haven't transferred it.
thank you.
wumingsden
ok,,, I found this banner script online someplace, and been trying to get it to work with my site... unfortunately when i used it the way it was,,, it would place the wrong banners in the wrong places,, messing up the site,,, below is the code after I somewhat repaired it didnt do much,,,...
I also think my todaysDate() could be done another way or better,, not sure yet,,, you can see what its doing at http://tusc-oh.com
my problem now is when I use the script, the first banner will show,, but the rest will not....
this is what its suppose to look like in the html when it shows:
Notice: ads[i] has a gif image...
Now, the next banner will show up the exact same way with an image, like below... (this is the same as the code from above, I just took out the main part I wanted to talk about...)
it has a different size image but doesnt show up in IE...
Now,,, when I use Firefox web browser, It works fine...
any suggestions?
Sorry so large...
thank you.
wumingsden
ok,,, I found this banner script online someplace, and been trying to get it to work with my site... unfortunately when i used it the way it was,,, it would place the wrong banners in the wrong places,, messing up the site,,, below is the code after I somewhat repaired it didnt do much,,,...
I also think my todaysDate() could be done another way or better,, not sure yet,,, you can see what its doing at http://tusc-oh.com
| Code: |
|
<?PHP // Functions: include '../inc/config.php'; // Gives today's date with no time function todaysDate() { list($dd,$mm,$yyyy) = split("-",date("d-m-Y",time())); return makeDateValue($dd,$mm,$yyyy); } function makeDateValue($dd,$mm,$yyyy) { return mktime(0, 0, 0, $mm, $dd, $yyyy); } ?> <SCRIPT LANGUAGE="JavaScript"> // Setup var curAd; var ads = new Array(); var delays = new Array(); var linx = new Array(); var external = new Array(); function displayAd() { var adLink = document.getElementById("ADLINK"); var ad = document.getElementById("AD"); if (ads.length) { ad.src = "<? echo $domain_ban; ?>/ads/"+ads[curAd]; adLink.href=linx[curAd]; if (external[curAd]) { adLink.target="_blank"; } else { // It's one of our own! adLink.target="_self"; } if (ads.length > 1) // Skip refresh if we only have 1 ad! setTimeout("displayAd()",delays[curAd]*1000); // Move on curAd = (++curAd) % ads.length; } } </SCRIPT> <DIV align=center> <A id=ADLINK href="#"> <IMG id=AD border=0 src="#"> </A> <SCRIPT LANGUAGE="JavaScript"> // Setup var i = 0; // PHP generated JavaScript array: <?php $fd = fopen ("".$domain_ban."ads/".$_REQUEST['size']."_ads.csv", "r"); //$fd = fopen ("./Ads/ads.csv", "r"); if ($fd) { $adsUsed = 0; $today = todaysDate(); $line = null; while (!feof ($fd)) { if (!$line) { // Skip header $line = fgets($fd, 4096); } else { $line = fgets($fd, 4096); if (strlen($line) > 10) { list($startDate,$durationMonths,$adDurationSecs,$pipeSeparatedImages,$URL) = split (",", $line, 5); list($dd,$mm,$yyyy)= split ("\/", $startDate, 3); $startDateTime = mktime(0, 0, 0, $mm, $dd, $yyyy); $endDateTime = mktime(0, 0, 0, $mm + $durationMonths, $dd, $yyyy); if ($durationMonths < 0 || ($durationMonths > 0 && ($startDateTime <= $today ) && ($today <= $endDateTime))) { // We've got a contender ++$adsUsed; $image = split("\|",$pipeSeparatedImages); foreach($image as $anImage) { if (strtolower(substr($pipeSeparatedImages,0,7))=="http://") { echo "external[i]=true;\n"; } echo "ads[i] = \"$anImage\";\n"; echo "linx[i] = \"".rtrim($URL)."\";\n"; echo "delays[i++] = $adDurationSecs;\n"; } } } } } fclose($fd); } ?> // Prevent same start ad being shown on every new page.. add random element curAd = <?php echo rand(0,$adsUsed - 1); ?>; displayAd(); </SCRIPT> </DIV> |
my problem now is when I use the script, the first banner will show,, but the rest will not....
this is what its suppose to look like in the html when it shows:
Notice: ads[i] has a gif image...
| Code: |
|
<SCRIPT LANGUAGE="JavaScript"> // Setup var i = 0; // PHP generated JavaScript array: ads[i] = "120x90.gif"; linx[i] = "http://tusc-oh.com/b/index.php"; delays[i++] = 15; // Prevent same start ad being shown on every new page.. add random element curAd = 0; displayAd(); </SCRIPT> </DIV></td><td valign="top"><SCRIPT LANGUAGE="JavaScript"> // Setup var curAd; var ads = new Array(); var delays = new Array(); var linx = new Array(); var external = new Array(); function displayAd() { var adLink = document.getElementById("ADLINK"); var ad = document.getElementById("AD"); if (ads.length) { ad.src = "http://tusc-oh.com/b//ads/"+ads[curAd]; adLink.href=linx[curAd]; if (external[curAd]) { adLink.target="_blank"; } else { // It's one of our own! adLink.target="_self"; } if (ads.length > 1) // Skip refresh if we only have 1 ad! setTimeout("displayAd()",delays[curAd]*1000); // Move on curAd = (++curAd) % ads.length; } } </SCRIPT> <DIV align=center> <A id=ADLINK href="#"> <IMG id=AD border=0 src="#"> </A> |
Now, the next banner will show up the exact same way with an image, like below... (this is the same as the code from above, I just took out the main part I wanted to talk about...)
it has a different size image but doesnt show up in IE...
| Code: |
|
// PHP generated JavaScript array: ads[i] = "728x90.gif"; linx[i] = "http://tusc-oh.com/b/index.php"; delays[i++] = 15; // Prevent same start ad being shown on every new page.. add random element curAd = 0; displayAd(); |
Now,,, when I use Firefox web browser, It works fine...
any suggestions?
Sorry so large...
