Re: Parsing .css files with php: Cons? [message #176683 is a reply to message #176676] |
Tue, 17 January 2012 10:42 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 1/16/2012 10:36 PM, J. Frank Parnell wrote:
> given: I know about @import and cascading styles, etc etc.
>
> Is is cool to parse .css files with php? Like I may want to include()
> sections into an overall .css. Or i may want to do like color:#<?php
> echo $thecolor; ?>. That kind of stuff.
>
> I guess there might be a little more overhead, but what's a few .css
> files within a whole cms like wordpress? I'm just looking for gotchas
> and unforseen problems.
>
> thanks,
> j
Hi,
It is possible, but I prefer making multiple stylesheets.
Make the included stylesheet conditional.
eg:
<?php
$usedstylesheet = ($test?"mycss/ver_abc.css":"mycss/ver_123.css");
$>
<link type="text/css" rel="stylesheet" media="screen" charset="utf-8"
href="http://www.example.com/<?php echo $usedstylesheet; ?>">
That way you have no PHP defining your stylesheet. That will make
webdesigners who have to modify it later happy. ;-)
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|