Quote:
Originally Posted by Ranger269
That's what I figured the problem was but I didn't know how to do it.
Code:
<div align="center">$random_banner[$random_number]</div>
When I tried adding a "2" between "number" and "]", it made the bottom banner disapear.
Can you tell me what code I need and if both of them need to be changed or only the bottom one?
|
The variable names need to be unique for each rotation instance.
So for Banner Rotation A, you'd have:
Code:
$random_number = rand(1, 5);
$random_banner[1] = '<a href="http://www.link1.com/"><img src="path/to/banner1.gif" alt="" border="0" /></a>';
$random_banner[2] = '<a href="http://www.link2.com/"><img src="path/to/banner2.gif" alt="" border="0" /></a>';
$random_banner[3] = '<a href="http://www.link3.com/"><img src="path/to/banner3.gif" alt="" border="0" /></a>';
$random_banner[4] = '<a href="http://www.link4.com/"><img src="path/to/banner4.gif" alt="" border="0" /></a>';
$random_banner[5] = '<a href="http://www.link5.com/"><img src="path/to/banner5.gif" alt="" border="0" /></a>';
And use:
Code:
$random_banner[$random_number];
And then for Rotation B, you'd have:
Code:
$random_number2 = rand(1, 5);
$random_banner2[1] = '<a href="http://www.link1.com/"><img src="path/to/banner1.gif" alt="" border="0" /></a>';
$random_banner2[2] = '<a href="http://www.link2.com/"><img src="path/to/banner2.gif" alt="" border="0" /></a>';
$random_banner2[3] = '<a href="http://www.link3.com/"><img src="path/to/banner3.gif" alt="" border="0" /></a>';
$random_banner2[4] = '<a href="http://www.link4.com/"><img src="path/to/banner4.gif" alt="" border="0" /></a>';
$random_banner2[5] = '<a href="http://www.link5.com/"><img src="path/to/banner5.gif" alt="" border="0" /></a>';
And use:
Code:
$random_banner2[$random_number2];
Each rotation instance *doesn't* have to be put in a separate plugin; you can store each in the same plugin.