Forum Moderators: phranque
text/css. I do this regularly and it works perfectly. You will need to add a caching mechanism, otherwise your stylesheet will be called with each page view. I usually consider one hour to be enough, but you can adjust that. Here's the code:
<?php
ob_start ("ob_gzhandler"); // only needed if you want to gzip the file
[b]header("Content-Type: text/css");[/b]
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ; // 1 hour
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?> The header line is the most important thing. :)
For random changes, you should really be adding the styles directly into the head of the document - there is no advantage to using a separate stylesheet (in fact there is the disadvantage of having to call a separate file).