View Full Version : random logos
imported_badblu01
04-12-2004, 11:24 AM
Hello
I was wondering if there was code or a program for random logos i have about 4 diffrent title logos i want to use and i want a new one to load each time the forum is visited.
And i was also wondering if there was such a code or hack will it work with vbadvance homepage?
Tony G
04-12-2004, 11:28 AM
Moving to Modification Requests, please don't ask questions in modification submission only forums. Thanks. :)
Heres a simple un-tested script that will produce a random image on page load, stick this anywhere on a new line in your phpinclude_start template and see what it dose for you.
// # Brad's random banners
// get a number between 1 and 4
$image_id = rand(1,4);
// we got a id, now figure out the name of the image
switch($image_id)
{
// if the random number is one display
case '1':
$banner_name = 'banner1';
break;
// or if two is the scripts thing
case '2':
$banner_name = 'banner2';
break;
// Mabey it prefers three
case '3':
$banner_name = 'banner3';
break;
// Must be four...
case '4':
$banner_name = 'banner4';
break;
// The script could'nt generate a random number for some reason, so we wil use this fail safe image
default:
$banner_name = 'banner_failsafe';
break;
}
// end banner generator
Now you just type the normal html in the header template (or where ever else you want, as long as the script is using vBulletin's global.php). But you will use $banner_name in place of the image name. So <img src="banner.gif"> would become <img src="$banner_name.gif">
Also remember you will need to edit $banner_name (all 5 times it appers) in the php code to match the image names of your banners. There are 5 because the last one is a fail safe, incase for some reason php can not produce a random number but can still display the rest of the page.
imported_badblu01
04-13-2004, 06:32 AM
thanks for your help
imported_Diggin
04-14-2004, 01:13 AM
works great, thanks
Auron
08-17-2005, 09:30 PM
many thanks was looking for a script exactly like this
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.