FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Parsing .css files with php: Cons?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Parsing .css files with php: Cons? [message #176683 is a reply to message #176676] Tue, 17 January 2012 10:42 Go to previous messageGo to previous message
Erwin Moller is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: phpinfo is not showing in php4 version
Next Topic: arrays with holes
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 16:33:52 GMT 2024

Total time taken to generate the page: 0.03847 seconds