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 #176747 is a reply to message #176746] Sat, 21 January 2012 20:53 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 1/21/2012 2:31 PM, Chuck Anderson wrote:
> J.O. Aho wrote:
>> Chuck Anderson wrote:
>>> Michael Fesser wrote:
>>>> .oO(Captain Paralytic)
>>>>
>>>> > On Jan 20, 10:25 am, Michael Fesser <neti...@gmx.de> wrote:
>>>> >> No. You have to explicitly send the correct header or some browsers
>>>> >> might ignore the CSS. For example
>>>> >>
>>>> >> header('Content-Type: text/css; charset=UTF-8')
>>>> > Oh OK. Any ideas which ones?
>>>>
>>>> In the past Gecko browsers (i.e. Firefox) were a bit picky about the
>>>> correct CSS content type. If the file wasn't delivered as text/css, it
>>>> was ignored.
>>>>
>>> I have successfully used:
>>> header("Content-type: text/css");
>>>
>>> After implementing a php based style sheet a couple of different
>>> times it
>>> seemed wasteful, and a bit of a kludge. If the style sheet is ultimately
>>> static, it is wasteful to keep generating one every time it is used.
>>> Now I use
>>> a php script to generate the style sheet file for me. If I want to make
>>> changes I edit the php based file (or any included definition files,
>>> e.g.,
>>> colors.php) and run it.
>>>
>>
>> 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."
>
> In preparation, I write a script that opens a file for writing (the css
> file) and then one long heredoc to create it's contents. This creates an
> easily reusable system for very little extra work.
>
>> I could see a bit more point of your script if you have a database as
>> a backend, where you store the values and recreate the css each time
>> the values change.
>
> It's not a database, but I include color definitions from a separate php
> file.
>

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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[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: Thu Nov 28 09:29:49 GMT 2024

Total time taken to generate the page: 0.04967 seconds