Hi Guys... I ran into a problem today. I am designing a new site and my background image is show in my style sheet. I need to know if I can throw php in a .css file to execute a php random image function. The idea is to display a new image at random on a refresh or new visit. So can I do this, or does anyone know of a different or maybe better way? Thanks Guys
You can use a php script to output valid CSS. So yes. The link would have to be say style.php and php would do its processing part then output the CSS.
great thanks so much so the css would be be: body { background-image: url('style.php'); } Code (markup): Then have the PHP script return the jpg value Is that what you are saying? Thanks
no, the link from the main page would be to style.php. Though there isn't anything stopping you from doing it the way you listed, it should work. I know it works with the img tag. Just haven't bothered to do it link rel="stylesheet" href="style.php" ... blah ... blah then style.php would do the processing if($mode=="alpha") { echo " body { background-image: url('style.php'); }": else { .... } then the rest of the style sheet.