SimplePortal
Customization => Custom Coding => Topic started by: ehsizzup on June 07, 2009, 01:04:25 AM
-
Hi.
I have a block that I would like to use to show a random section of html code.
kind of like....
$rand = rand (1,some number)
if $rand = 1 show some html
if $rand = 2 show some different code
etc....
This is probably 10 lines of code. Can someone hook me up?
-
* Split from the sticky topic.
Some PHP code for a Custom PHP block:
$html = array(
'htmlcode',
'different html code',
'other html code',
'more html code',
);
echo $html[rand(0, count($html) - 1)];
You can add as many entries into the array as you like (make sure that you escape any ' quotes like this \').
-
Thanks again.