The solution that links offers should work, and turning it in a link should be easy. I'm a fan of splitting the code and design between the PHP and TPL files, so here's an easy solution to have random images displayed at one or all pages.
I'm not sure if you're going to use an existing banner management system or make a custom though (if people request this I can make something for the admin panel, I'm going to need it in the future anyway).
1. Add in sidebar.tpl or wherever you want the banner:
Code:{if $banner_1}<span style='banner-style1'>{$banner_1}</span>{/if}
2. Open index.php for banner info (would be better if it's pulled from the database and manageable from the admin panel ofcourse):
Find:
Code: if(!isset($_SERVER['HTTP_REFERER'])) {
$_SERVER['HTTP_REFERER'] = '';
}
Add under:
Code:// Random Banners Script
$ammount = '6'; //The ammount of banners available (all should be set below)
$randomize = Rand (1,$ammount); //Picks one randomly (all equal chance)
switch($randomize)
{
case 1: $image = 'banner_1.gif'; $url = 'http://www.jobberbase.com/page-1'; $bannertext = 'Jobberbase Website'; break;
case 2: $image = 'banner_2.gif'; $url = 'http://www.jobberbase.com/page-2'; $bannertext = 'Jobberbase Website'; break;
case 3: $image = 'banner_3.gif'; $url = 'http://www.jobberbase.com/page-3'; $bannertext = 'Jobberbase Website'; break;
case 4: $image = 'banner_4.gif'; $url = 'http://www.jobberbase.com/page-4'; $bannertext = 'Jobberbase Website'; break;
case 5: $image = 'banner_5.gif'; $url = 'http://www.jobberbase.com/page-5'; $bannertext = 'Jobberbase Website'; break;
case 6: $image = 'banner_6.gif'; $url = 'http://www.jobberbase.com/page-6'; $bannertext = 'Jobberbase Website'; break;
}
$banner_1 = '<a href="'.$url.'" title="'.$bannertext.'"><img src="'.BASE_URL.'img/banners/'.$image.'" alt="'.$bannertext.'" /></a>';
$smarty->assign('banner_1', $banner_1);
// End Random Banners Script
You can adjust the CSS to add different styles to the <span>, like you should remove any mouse-over effect for links as it would be ugly with images. Note that I didn't test this code, let me know if it works or not.
Last edited by Chronos (2009-01-07 23:00:03)
Member of Jobberbase Development Team - Implementation and Coding
Visit my Blog:
ChronoScripts (JobberBase scripts, support and freelance)
JobBoards:
Telefonisch Werk and
Top Bijbaan