[thelist] Using PHP to write CSS

Burhan Khalid burhankhalid at members.evolt.org
Mon May 20 14:09:01 CDT 2002


Hello all :

    I already have a solution to this problem, but was wondering wether a
more elegant solution could be had. I have a box in CSS. I set its width
using PHP (from an random image's width). In my setup previous to this, I
had my CSS set up like this :

<style type="text/css">
@import "otherstyles.css"

box {

        width : <?= blah; ?>
}
</style>

The problem with this was that it would not dissapear when viewed with
Netscape 4.x and since that browser has poor support for CSS, the box is not
rendered properly. My current solution involves opening up the css file, and
appending the box's css definition at the end. What I would like to be able
to do is to have PHP search a file for a particular string, and then replace
it with whatever I want. I am trying to keep my css file organized into
chunks (globals, layout, etc), and my current solution doesn't work well
with this. Short of having separate css files, is there a way to have PHP
scan a file for a place holder and then replace it with something else? I'm
looking for a greymatter-like {{something}} type solution.

Any ideas?
Regards,
Burhan Khalid




More information about the thelist mailing list