trichome
Member
In the footer of my forum I'd like to display a list with 3 links randomly pulled from a pool.
Here's the PHP code I've been using:
Basically 3 list items, each with a unique css class with a random, unique link in each.
Is there a way to achieve the same result using the following code which was posted here?
Here's the PHP code I've been using:
PHP:
<?php
function listLinks()
{
$linkpool=array(
'<a href="#">link 01</a>';
'<a href="#">link 02</a>';
'<a href="#">link 03</a>';
'<a href="#">link 04</a>';
'<a href="#">link 05</a>';
'<a href="#">link 06</a>';
);
$rand_keys = array_rand($linkpool, 3);
echo "\t\t<li class=\"a\">" . $linkpool[$rand_keys[0]] . "</li>\n";
echo "\t\t<li class=\"b\">" . $linkpool[$rand_keys[1]] . "</li>\n";
echo "\t\t<li class=\"c\">" . $linkpool[$rand_keys[2]] . "</li>\n";
}
listLinks();
?>
Basically 3 list items, each with a unique css class with a random, unique link in each.
Is there a way to achieve the same result using the following code which was posted here?
Code:
<xen:comment>DEFINE AND RANDOMIZE YOUR BANNERS</xen:comment>
<xen:set var="$banners.1">banner one</xen:set>
<xen:set var="$banners.2">banner two</xen:set>
<xen:set var="$banners.3">banner three</xen:set>
<xen:set var="$banners.4">banner four</xen:set>
<xen:set var="$banners.5">banner five</xen:set>
{xen:raw '$banners.{xen:calc '({$serverTime} % 5) + 1'}'}