je ferais comme ca mais y'a peut etre mieux:
<?php
function banniere ()
{
// on définit les bannieres
$bannieres=array();
$bannieres[]=array('1.jpg', 'http://1.com');
$bannieres[]=array('2.jpg', 'http://2.com');
$selection = rand(0, (count($bannieres)-1));
// on retorune un array (image, lien)
$retour = array();
$retour[0] = $bannieres[$selection][0];
$retour[1] = $bannieres[$selection][1];
return $retour;
}
?>
<?php
$pub=banniere();
?>
<a href="<?php echo $pub[1] ?>" title="<?php echo $pub[1] ?>">
<img src="<?php echo $pub[0] ?>" alt="<?php echo $pub[0] ?>" />
</a>
|