[]
ChAoS said: Would it be hard to add in a variable that would rotate them without refreshing the page?
Maybe something similar to this?
<?php // DynAds: Display an ad per period
$StartDate = "15 January 2004" ;
$PeriodHours = 24 ;
$AdGroup = "NameOfTheAdGroup" ;
$DispPosName = "NameForThisAdDisplayPosition" ;
$ScriptUrl = "http://YourDomain/DynAdsInstallPath/ad.pl" ;
// No editing beyond this line
$PerCount = (int)((time() - strtotime($StartDate)) / ($PeriodHours*60*60)) ;
$url = $ScriptUrl . "?pos=" . urlencode($DispPosName) . "&agn=" . urlencode($AdGroup) . "&dsp=html&sel=seq&ano=" . $PerCount ;
@include($url) ;
?>
<<<<gets ready to duck and run
[/]
Ewww.
What you'll want to do is use client-side scripting for this task ie. Javascript as opposed to server-side scripting ie. PHP
So try this instead then. Add the following code to your generic template where the PHP include line is from my original mod which won't be needed anymore...
<script language="JavaScript"> <br /> <!-- <br /> function adArray() { <br /> for (i=0; i*2<adArray.arguments.length; i++) { <br /> this[i] = new Object(); <br /> this[i].src = adArray.arguments[i*2]; <br /> this[i].href = adArray.arguments[i*2+1]; <br /> } <br /> this.length = i; <br /> } <br /> function getAdNum() { <br /> dat = new Date(); <br /> dat = (dat.getTime()+"").charAt(8); <br /> if (dat.length == 1) <br /> ad_num = Math.floor(Math.random() * ads.length); <br /> else <br /> ad_num = 0; <br /> return ad_num; <br /> } <br /> var ads = new adArray( <br /> <br /> "/ubbthreads/images/banners/bajbnr.jpg","http://www.bajema.com", <br /> "/ubbthreads/images/banners/melancholicban.jpg","http://melancholic.net", <br /> "/ubbthreads/images/banners/decayingmadness.gif","http://www.decayingmadness.com", <br /> "/ubbthreads/images/banners/vixshop.gif","http://www.vixenshop.com", <br /> "/ubbthreads/images/banners/giger.jpg","http://www.giger.com/mainflash.htm", <br /> "/ubbthreads/images/banners/projectpitchfork.jpg","http://www.pitchfork.de/page_en.php?", <br /> "/ubbthreads/images/happyhalloween.gif","http://emeraldforestseattle.com"); <br /> <br /> var ad_num = getAdNum(); <br /> document.write('<CENTER><TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0><TR><TD ' <br /> +'ALIGN=CENTER>'+'</TD><TR></TR><TD><A HREF="'+ads[ad_num].href+'"><IMG SRC="'+ads[ad_num].src+'" ' <br /> +'WIDTH="468" HEIGHT="60" BORDER=0 name=js_ad></A></TD></TR></TABLE></CENTER>'); <br /> link_num = document.links.length-1; <br /> function rotateSponsor() { <br /> if (document.images) { <br /> ad_num = (ad_num+1)%ads.length; <br /> document.js_ad.src = ads[ad_num].src; <br /> document.links[link_num].href = ads[ad_num].href; <br /> setTimeout("rotateSponsor()",60000); <br /> } <br /> } <br /> setTimeout("rotateSponsor()",60000); <br /> // --> <br /> </script>