On 9/21/06, tedd <tedd@xxxxxxxxxxxx> wrote:
At 10:37 AM -0500 9/21/06, David Giragosian wrote: >On 9/21/06, tedd <<mailto:tedd@xxxxxxxxxxxx>tedd@xxxxxxxxxxxx> wrote: >-snip- > >Now, this header coupled with the above .htaccess allows php code to >be embedded within a css file AND work for all popular browsers, >including FireFox/Mozillia. >-snip- > >tedd, > >So with this approach you're able to tailor css styles for specific >browsers and their particular implementations of css, rather than >employ hacks directly in the css?? David: Yes, plus much more. This is similar to getting php/html to play nice together. What I've discovered here (if no one has considered this before, which I would think is highly doubtful) is a way to embed php code within css (like html) to do anything you want. You see, my chief complaint with css over the years has been its lack of variables. Many in the css camp say that the lack of variables is a feature and not a drawback -- and I understand them not wanting the unclean masses to contaminate their pure language. But, not knowing any better, I've always wanted to use variables in css. A few years back, I published my limited version of how to use variables in css: http://www.sperling.com/examples/pcss/ But for most, it was too problematic to implement and had limited scope. However, what I've discovered here is that by adding the proper .htaccess file and the addition of a header in the css file, you can do anything you want from within a css file -- which includes adding variables, adding "includes", performing computations, browser sniffing, and I think anything else you can do in php. The extent could be as unlimited as php/html -- I don't know the full extent. As far as I'm concerned, this is a significant discovery for me -- I'm always trying to get different languages to work together. However, to others, perhaps this technique has been obvious or too trivial to mention. I don't know, but I haven't found any references that address this technique. To the gang -- is this something new, or am I getting excited over nothing? In any event, I'll be adding "how to do it" to my web site so I can lead others astray. :-) Thanks. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
I've been doing this with CSS and JavaScript a while now. Especially with external JavaScript that is generated based on the current page... like validation and such. One exception is I make the file extensions php so my editor makes them pretty for me, but still always adding the appropriate headers I haven't ran into any problems.