Random Header Image
#9
Code's a little long Confused

I don't like referring to another PHP file - it's just extra overhead. If you don't mind some file editing, edit your /global.php (what I do):
FIND:
if(!preg_match("#^(\/|\.\.|\.|([a-z0-9]+)://)#i", $theme['logo']))
{
	$theme['logo'] = $mybb->settings['bburl']."/".$theme['logo'];
}
REPLACE WITH:
$logos = array('picture1.jpg', 'picture2.jpg');
$theme['logo'] = $mybb->settings['bburl']."/images/logo/".$logos[mt_rand(0,count($logos))];
You'll need to upload all your banners into your /images/logo/ folder. All you have to do with the above code is change the first line.
As a bonus, with this method, the images are also cached on the client's computer, so it reduces useless hits and makes their browsing faster Toungue
Reply


Messages In This Thread
Random Header Image - by gauss - 2007-11-19, 02:45 AM
RE: Random Header Image - by pepotiger - 2007-11-19, 03:39 AM
RE: Random Header Image - by DrPoodle - 2007-11-19, 10:42 AM
RE: Random Header Image - by gauss - 2007-11-19, 11:26 AM
RE: Random Header Image - by DrPoodle - 2007-11-19, 12:19 PM
RE: Random Header Image - by PwnEm - 2007-11-19, 09:49 PM
RE: Random Header Image - by User 2877 - 2007-11-19, 10:05 PM
RE: Random Header Image - by gauss - 2007-11-19, 11:42 PM
RE: Random Header Image - by Yumi - 2007-11-21, 11:40 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)