[thelist] Conditionals in CSS - php?

Tom Dell'Aringa pixelmech at yahoo.com
Fri Oct 1 08:12:19 CDT 2004


--- "Luther, Ron" <ron.luther at hp.com> wrote:
> (1) Randomly rewrite the picture.
> You can name your pictures 'Pix1.jpg' thru 'Pix9.jpg'...snip

This is what I ended up doing. Here is my code (thanks to those who supplied) for those
interested:

<?php
header("Content-Type: text/css");
header("Expires: ".gmdate("D, d M Y H:i:s", (time()+600)) . " GMT"); //Expires in 10 minutes
srand ((double) microtime( )*1000000);
$random_number = rand(1,3); // I have 3 pictures right now. I'll change this when I add more.
?>

#banner { width: 750px; height: 175px; background: transparent
url(/images/bannerback_<?=$random_number?>.jpg); }

Tom

=====
Get Firefox! | http://www.pixelmech.com/


More information about the thelist mailing list