PDA

View Full Version : Different Banners


tzdesigner
09-06-2002, 01:04 AM
Im making a adv. forum and I want to know how to get banners to change everytime the index.php refreshs.

BearDoc
09-06-2002, 12:56 PM
use java or cgi

assassingod
09-06-2002, 01:58 PM
I did used to know the code for that using javascript. I guess I can use all my brainpower to think of it for you. Otherwise you'll have to use PHP, which is for vB.org.

I think I know the code for it in PHP as well :rolleyes:

EDIT: Ok, I remembered it almost straight away. here it is (Add this to your body tag, where you want the banner to appear.) Bits in blue require you to change whatever is there.

This will have 3 different images each time the person refreshes DOnt forget to change the width/height ETC.

<SCRIPT LANGUAGE="JavaScript">
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
if (ad==1) {
txt="TEXT";
url="URL";
alt="ALT TEXT";
banner="BANNER URL";
width="468";
height="60";
}
if (ad==2) {
txt="TEXT";
url="URL";
alt="ALT TEXT";
banner="BANNER URL";
width="468";
height="60";
}
if (ad==3) {
txt="TEXT";
url="URL";
alt="ALT TEXT";
banner="BANNER URL";
width="468";
height="60";
}
document.write('<center>');
document.write('<a href=\"' + url + '\" target=\"_top\">');
document.write('<img src=\"' + banner + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('alt=\"' + alt + '\" border=0><br>');
document.write('<small>' + txt + '</small></a>');
document.write('</center>');
</SCRIPT>


I think thats it

tzdesigner
09-06-2002, 07:07 PM
ok ty

assassingod
09-06-2002, 07:31 PM
If that doesnt work, PM me

tzdesigner
09-06-2002, 08:37 PM
ok well im purchasing my license this weekend so Ill be testing it sometime next week. But if it doesnt work I'll PM you for sure...thanks again

assassingod
09-06-2002, 09:33 PM
Ah, ok, hope it works:)

No problem:)

Tony G
09-07-2002, 12:28 AM
That would be a useful script. But remember, this is a Template discussion forum. For files head over to vB.org.

Thank you.

assassingod
09-07-2002, 12:31 AM
Its not a PHP file edit though? :confused: But I think I see the point you're making. No JS or PHP, only HTML???

tzdesigner
09-07-2002, 01:13 AM
vb.com is a churchs website,lol :)

Tony G
09-07-2002, 01:17 AM
Originally posted by ffdcsite
Its not a PHP file edit though? :confused: But I think I see the point you're making. No JS or PHP, only HTML???

Mis-read, my apologies.

assassingod
09-07-2002, 01:18 AM
Thats ok:)

tzdesigner its www.vbulletin.org :)

tzdesigner
09-07-2002, 01:20 AM
o ok ty

assassingod
09-07-2002, 01:20 AM
No problem:)