Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #4556

Re: Parsing .css files with php: Cons?

From Chuck Anderson <cycletourist@invalid.invalid>
Newsgroups comp.lang.php
Subject Re: Parsing .css files with php: Cons?
Date 2012-01-21 12:31 -0700
Organization cycletourist.com
Message-ID <jff3rm$das$1@dont-email.me> (permalink)
References (4 earlier) <83gih757lb1shbfamuk67juagcmftmiu0d@mfesser.de> <65ce085f-7e7d-4ae3-af69-f96370944eac@m11g2000yqe.googlegroups.com> <u0tih7dujcepc0r4td8jf4trspbvbdtnna@mfesser.de> <jfd5l1$cmc$1@dont-email.me> <9nv6n4F6anU1@mid.individual.net>

Show all headers | View raw


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.

-- 
*****************************
 Chuck Anderson • Boulder, CO
  http://cycletourist.com
 Turn Off, Tune Out, Drop In
*****************************

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Parsing .css files with php: Cons? "J. Frank Parnell" <juglesh@gmail.com> - 2012-01-16 13:36 -0800
  Re: Parsing .css files with php: Cons? Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-01-17 11:42 +0100
  Re: Parsing .css files with php: Cons? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-01-17 13:31 +0100
  Re: Parsing .css files with php: Cons? Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-17 04:32 -0800
    Re: Parsing .css files with php: Cons? "J. Frank Parnell" <juglesh@gmail.com> - 2012-01-19 12:45 -0800
      Re: Parsing .css files with php: Cons? Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-20 02:07 -0800
        Re: Parsing .css files with php: Cons? Michael Fesser <netizen@gmx.de> - 2012-01-20 11:25 +0100
          Re: Parsing .css files with php: Cons? Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-20 05:33 -0800
            Re: Parsing .css files with php: Cons? Michael Fesser <netizen@gmx.de> - 2012-01-20 15:05 +0100
              Re: Parsing .css files with php: Cons? Chuck Anderson <cycletourist@invalid.invalid> - 2012-01-20 18:50 -0700
                Re: Parsing .css files with php: Cons? "J.O. Aho" <user@example.net> - 2012-01-21 08:10 +0100
                Re: Parsing .css files with php: Cons? Chuck Anderson <cycletourist@invalid.invalid> - 2012-01-21 12:31 -0700
                Re: Parsing .css files with php: Cons? Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-21 15:53 -0500
                Re: Parsing .css files with php: Cons? Michael Fesser <netizen@gmx.de> - 2012-01-21 22:22 +0100
                Re: Parsing .css files with php: Cons? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2012-01-21 21:37 +0000
                Re: Parsing .css files with php: Cons? Michael Fesser <netizen@gmx.de> - 2012-01-22 22:35 +0100
                Re: Parsing .css files with php: Cons? Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-22 19:19 -0500
                Re: Parsing .css files with php: Cons? Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-21 17:08 -0500
                Re: Parsing .css files with php: Cons? Chuck Anderson <cycletourist@invalid.invalid> - 2012-01-21 18:17 -0700
                Re: Parsing .css files with php: Cons? Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-21 23:14 -0500
                Re: Parsing .css files with php: Cons? Michael Fesser <netizen@gmx.de> - 2012-01-22 22:35 +0100
                Re: Parsing .css files with php: Cons? "Peter H. Coffin" <hellsop@ninehells.com> - 2012-01-22 17:14 -0600
                Re: Parsing .css files with php: Cons? Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-22 19:21 -0500
                Re: Parsing .css files with php: Cons? Michael Fesser <netizen@gmx.de> - 2012-01-23 23:44 +0100

csiph-web