[thelist] Conditionals in CSS - php?

Luther, Ron ron.luther at hp.com
Fri Oct 1 07:43:42 CDT 2004


Tom Dell'Aringa asked:

>>I'm wanting to rotate some pictures in the banner of my site. 
>>I'm using PHP as my server side scripting. 

Hi Tom,

Two other potential solutions:

(1) Randomly rewrite the picture.
You can name your pictures 'Pix1.jpg' thru 'Pix9.jpg' and have some 
PHP code that picks a random number from 1 to 9 and copies 'Pixn.jpg' 
to a new file name, like 'Pixa.jpg'. Your banner page would only 
need to call and display 'Pixa.jpg'.

(I used to have one of these running in ASP ... (I had 3 CSS files 
for my personal site - a visit would randomly grab a color scheme 
and photo - hard refresh would also work - once generated it would 
persist throughout the visit.) ... I need to rewrite it to work in 
PHP.)


(2) Use a database.
Put all the picture reference information in a database. Add a 
'picture number' field. Have your PHP page pick a random number 
and then pull that 'picture number' record out of the database 
and display that picture.

(I have one of these working in PHP today.)


HTH,

RonL.



More information about the thelist mailing list