Re: PHP & CSS

From: Date: Mon, 06 Oct 2003 18:29:47 +0000
Subject: Re: PHP & CSS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-165220@lists.php.net to get a copy of this message
On Mon, 6 Oct 2003 11:13:04 -0700, you wrote: >I'm currently building a dynamic site which draws page configuration >variables from config (ini) files. To use those variables from the >ini files, I write the style sheet in the header of each page. > >Here's my problem. I want to link to a style sheet rather than >writing it to the page head, so that it's not visible by viewing the >page source. I'm not sure how to draw the variable values from the >ini file and apply them to the style sheet. Does anyone have any >help? How often will they change, realistically? There's a case for just hard-coding them - a CSS file is pretty much a config file anyway. Or running a script as a cron job that updates the CSS once a day from the config file. Of neither of those are acceptable... CSS files don't actually have to end with .css. Rename your *.css file to *.php, and add a <? header('Content-Type: text/css'); ?> line at the top of the file. If you go this route, make sure you've got your caching headers set up correctly - if the browser comes back for the CSS file every single time, you've defeated the object of having it.

« previous php.general (#165220) next »