View Full Version : Anyone really good with PHP or JS?
I am having some issues getting a rotating banner script set up in the header of the forums. I have the banners sized already, and on the server. But I can't for the life of me get the script up and working right. Anyone know of one that would rotating a few (3 or 4) banners at the top of the forum upon page refresh?
Thanks!
LightningGSX
11-22-2004, 07:09 AM
How about a timed banner rotator?
scheides
11-22-2004, 09:25 AM
As much as I'd prefer to run php over JS, here's a few examples. These are all cgi-based, which is probably the best way to run them, but you could probably rip out some of the code and use it as a header:
http://www.autoinstaller.de/banner-rotator.html
http://www.geocities.com/jsmaster/banrot.html
http://www.geocities.com/SiliconValley/7116/banner2.zip
http://javascript.internet.com/messages/banner-ads.html
http://www.bloke.com/javascript/AdRotation/
PM know if you need help,
-scheides
Jakey
11-22-2004, 08:20 PM
I don't know if it would be any help at all but I've got a copy of Flash MX 2004 and Dreamweaver MX 2004 if it would help you out.
I am still working on this, and wonder is anyone else has any ideas. Thus far I have been unable to use anything llisted. I either get all the banners placed at the top in a mess or I get nothing.
this is the code I am trying to use:
-----
Code:
$bannerrand = rand(1, X);
and then use the number generated in your template whereever you want the banner, for instance in the "header" template. Example; rotating three banners (X=3 in the code above):
Code:
<if condition="$bannerrand == '1'">
<a href="Banner 1 hyperlink"><img src="Banner 1 Image URL" /></a>
<else />
<if condition="$bannerrand == '2'">
<a href="Banner 2 hyperlink"><img src="Banner 2 Image URL" /></a>
<else />
<a href="Banner 3 hyperlink"><img src="Banner 3 Image URL" /></a>
</if>
Anyone know why the thing won't rotate the banners with the code like this and just display them all at the top of the fourms together?
SuperSleeper
12-02-2004, 12:59 AM
Check out this site... may have some resources for you.
http://www.zend.com/apps.php?CID=35
Otherwise try this code:
function randInt(min,max)
{
var div = (max - min) + 1
var randNum = Math.random()
for (var i = 0; i <= div - 1; i++)
{
if (randNum >= i / div && randNum < (i+1) / div)
{return i + min}
}
}
var abc = randInt(1,5);
if (abc == 1) {
document.write("<\"Your 1. HTML-Banner-Code\">");
}
if (abc == 2) {
document.write("<\"Your 2. HTML-Banner-Code\">");
}
if (abc == 3) {
document.write("<\"Your 3. HTML-Banner-Code\">");
}
if (abc == 4) {
document.write("<\"Your 4. HTML-Banner-Code\">");
}
if (abc == 5) {
document.write("<\"Your 5. HTML-Banner-Code\">");
}
The "document.write" function is Javascript, and probably not necessary for the code to work. Haven't tested the code though, so don't hold your breath.
scheides
12-02-2004, 10:47 AM
What OS is your server? Why don't you just link to a static image, but setup a cron job changing what that static image is every 1, 2, 4, 5, 10 minuts, or whatever. Whenever your peak time is for the day, you could charge a premium to whomever wants to advertise more during that time, just like TV!
If you want code for this, let me know, it'd be *super* complicated ;)
-scheides
ps--cache-crazy browsers such as IE might not load the current version of the image right away, but would realize it after a few clicks/page reloads.
vBulletin® v3.8.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.