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 #176751 is a reply to message #176750] Sun, 22 January 2012 01:17 Go to previous messageGo to previous message
Chuck Anderson is currently offline  Chuck Anderson
Messages: 63
Registered: September 2010
Karma:
Member
Jerry Stuckle wrote:
> On 1/21/2012 4:22 PM, Michael Fesser wrote:
>> .oO(Jerry Stuckle)
>>
>>> On 1/21/2012 2:31 PM, Chuck Anderson wrote:
>>>> J.O. Aho wrote:
>>>> >
>>>> > I have to say it feels quite much of extra work, writing the php
>>>> > script which generates the css, as you need to edit the php file,
>>>> > then
>>>> > IMHO you can quite easily edit a css instead.
>>>>
>>>> I edit one php file and then simply invoke it. There is very little
>>>> more
>>>> "work."
>>>>
>>>> [...]
>>>
>>> I agree with J.O. Seems overly complicated to have to edit a PHP file
>>> which then generates the CSS. Much easier just to edit the CSS -
>>> especially when you have syntax-sensitive editors for CSS available.
>>
>> The whole point of using PHP for creating the CSS is to avoid having to
>> edit a dozen places in the CSS to change some color for example. Instead
>> you make use of PHP and variables. Much simpler.
>>
>> And if you still want a "static" CSS for performance reasons, you have
>> to preprocess it. Calling a script for doing this is not much work.
>> Dependent on the used IDE this could even be automated in the build and
>> upload process.
>>
>> Micha
>>
>
> Create your .css properly and you don't need to do that.
>

I use my css generating file, which I would hardly call a script (fopen,
fwrite, fclose), as a template for whatever miscellaneous project I end
up working on. I write lots of browser based web apps and this makes for
a real shortcut, as all I have to do is plug in some basic colors and I
get a style sheet with all the selectors I'm used to having available in
whatever color scheme I choose. At any time during or after development
I can stop using the script and just edit the style sheet directly - but
as long as I'm fiddling with colors I leave it dynamic.

It seems an unnecessary waste of server resources to keep calling the
php preprocesssor every time a page loads the .php style sheet. And it
also seems like using a header of Content-type: text/css for a php file
is a bit of a kludge.

But, to each their own - and for their own purposes. My method works
great for my needs.

--
*****************************
Chuck Anderson • Boulder, CO
http://cycletourist.com
Turn Off, Tune Out, Drop In
*****************************
[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:32:48 GMT 2024

Total time taken to generate the page: 0.04433 seconds