SimplePortal
Customization => Blocks and Modifications => Block Requests => Topic started by: MultiformeIngegno on February 07, 2010, 04:20:59 AM
-
Hi all! :)
I'm searching for a way to have a random div every time I load a page... 'till now I used this script (http://www.willmaster.com/library/features/random-div-display.php), but it's too doggone slow, fat and ugly..
How can I do it with PHP? It should be similar to this one, but instead of just images I need divs:
$banners = array(
array('YOUR IMAGE', 'YOUR LINK'),
array('YOUR IMAGE', 'YOUR LINK'),
array('YOUR IMAGE', 'YOUR LINK'),
);
$rand = rand(0, count($banners) - 1);
echo '<a href="', $banners[$rand][1], '"><img src="', $banners[$rand][0], '" alt="" /></a>';
Thanks in advance! ;)
-
OK I've found this...
http://simpleportal.net/index.php?topic=1745.msg11523#msg11523
It works! Only.. is there a way to avoid that every apostroph has to be escaped (\')? :)
P.S.: And sometimes with IE it displays a scroll bar if text is long... I've tried putting "overflow: visible" to "Custom body Style", but nothing changes..