If you look on my website http://www.jeepsource.org/forum you will see 2 banners at the top of the page. I want to rotate them like every xx minutes or each time the page is refreshed. I am a not good with coding so can you help me.
Announcement
Collapse
No announcement yet.
How do i rotate my banners?
Collapse
X
-
-
I had a similiar way.
Add a new plugin.
Product: vbulletin
Hook Location: global_start
Title: Image Rotator
Plugin PHP Code:
PHP Code:$rand = rand(1, 2);
if($rand == 1)
{
$display_image = "<a href='http://www.offroadoverstock.com'> <img
src='http://www.jeepsource.org/images/offroadoverstock468x60.jpg' border=0>";
}
else
{
$display_image = "<a href='http://www.raingler.com'> <img src='http://www.jeepsource.org/images/raingler1.gif' border=0>
</a>";
}
Open the template where you placed the two banners.
Delete them and replace with $display_imageComment
-
Originally posted by harmorI had a similiar way.
Add a new plugin.
Product: vbulletin
Hook Location: global_start
Title: Image Rotator
Plugin PHP Code:
PHP Code:$rand = rand(1, 2);
if($rand == 1)
{
$display_image = "<a href='http://www.offroadoverstock.com'> <img
src='http://www.jeepsource.org/images/offroadoverstock468x60.jpg' border=0>";
}
else
{
$display_image = "<a href='http://www.raingler.com'> <img src='http://www.jeepsource.org/images/raingler1.gif' border=0>
</a>";
}
Open the template where you placed the two banners.
Delete them and replace with $display_imageComment
-
PHP Code:<?php
$files = array();
$folder = './rotation/'; //folder with rotation graphics
$handle = opendir($folder);
$exts = explode(' ','jpg jpeg png gif');
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) { // for each extension check the extension
if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
$files[] = $file; // it's good
}
}
}
closedir($handle); // We're not using it anymore
$rand = array_rand($files);
header('Location: '.$folder.$files[$rand]); // Voila!
?>HTML Code:<div align="center"><img src="rotation.php" alt="" height="131" width="500" border="0" align="center" /></div>
Comment
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Comment