Does anyone out there have any experience with Dynamic CSS files with PHP? I'm trying to set a randomized background image for a div layer out of five background images I have -- the images themselves are stored in a database (which they need to be for reasons I'm not going to get into here) and need a processor to be interpreted. I think this may be the problem, because the processor is working, the other elements of the CSS file are working, and the pages that pull from it are seeing everything else. Unfortunately, none of the background images appear in the layer, as called here:
Code:
<div class="mainbody"><img src="images/title.gif">
testing one two three<br /><br /><br /><br /><br /><br /><br /><br /></div>
But here's the relevant chunk of the CSS, see if you can see anything here.
Code:
<?php
header("Content-Type: text/css");
include("includes/sqlconn.php");?>
#mainbody{
position:absolute;
top:0px;
width:100%;
height:100%;
margin:0px auto;
text-align:left;
background-image:url(http://www.mysite.net/images/image_processor.php?id=<?php $query="SELECT id FROM photos ORDER by rand() LIMIT 1";
$result=mysql_query($query);
while ($row=mysql_fetch_array($result)) {
echo($row['id'].");");
}
?>
Incidentally, in this case the randomization is less valuable to me than being able to store the images in the database. Any ideas would be appreciated.