Re: [PHP] php/css and .htaccess [SOLVED]
tedd wrote: At 10:37 AM -0500 9/21/06, David Giragosian wrote: On 9/21/06, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] 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 full ack, you only have to make sure that zlib.output_compression is off (at least in that folder), if you want IE6 users to be able to read the css content ! -- View this message in context: http://www.nabble.com/php-css-and-.htaccess-tf2308435.html#a6465094 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/css and .htaccess
On Wed, September 20, 2006 5:18 pm, tedd wrote: Hi gang: I embedded php code inside css and changed my .htaccess to read -- FilesMatch \.(htm|html|css)$ SetHandler application/x-httpd-php /FilesMatch -- so that the css file would be processed and executed by php. The end result was that everything worked and did what I wanted. However, FireFox / Mozillia won't accept a css file if a .htaccess file reads as indicated above. Any ideas as to how to get FireFox to play nice? Add a header(Content-type: text/css) to the top of it, so that the web-server isn't LYING to Mozilla and telling it that you're sending it an HTML file? Only IE would be STOOPID and look at the URL and the file contents and decide to ignore the headers. text/css may not be right. Whatever. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/css and .htaccess [SOLVED]
On Thu, September 21, 2006 10:37 am, David Giragosian wrote: 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?? That's one possible use. Really, though, once your CSS is dynamic as well as your HTML, life can be quite fun. :-) Or, perhaps, if your so-called web Designer left NO CONSISTENT SPACE on the layout for ERROR MESSAGES in a dynamic site, you might, just as a hypothetical example, have something like: ?php $error_position = array(10, 10, 500, 200); head('Page 1'); ? Then, in the .css file, you'd be using $error_position to cram the messages into an overflow: auto; at the $error_position, unique to each page, where the so-called designer left you any white space at all. Not that this ever happened to me, oh no. http://ralphsworld.com/ :-) PS I embedded the CSS, actually, as I don't trust browser caching to know that the CSS is also dynamic and changing. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/css and .htaccess [SOLVED]
On Thu, September 21, 2006 12:17 pm, tedd wrote: To the gang -- is this something new, or am I getting excited over nothing? I been doing it long time now... You mean everybody doesn't run their CSS through PHP so they can make it do what they want for each page? How odd... :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/css and .htaccess [SOLVED]
tedd wrote: I embedded php code inside css and changed my .htaccess to read -- FilesMatch \.(htm|html|css)$ SetHandler application/x-httpd-php /FilesMatch -- so that the css file would be processed and executed by php. The end result was that everything worked and did what I wanted. However, FireFox / Mozillia won't accept a css file if a .htaccess file reads as indicated above. Christopher Weldon answered: That shouldn't be expected. The SetHandler only applies to the Apache handler side, as browsers should not be able to read those files (.htaccess). So, are you 100% positive that PHP is in fact processing the file? Christopher , this is what I'm sure of: 1. My css file has php code in it. 2. Without the .htaccess as noted above, the php code is not processed. 3. With the .htaccess as above, the php code *is* processed. 4. All (most popular) browsers, except for FF/Mozillia, allow php inside of css. Please note that, Kreme and Wind (sounds like a Rock group) provided the answer, which was to add a header to the css file, like so: header('Content-Type: text/css; charset=ISO-8859-1'); So, it wasn't that the browsers were reading the .htaccess file, but rather because of the .htaccess file FireFox/Mozillia required a header in the css file just to keep things straight (my understanding). 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. This is simply amazing, at least to me, and completes my next step toward world domination. :-. Many thanks gang for your most excellent and mondo kewl advice. tedd PS: So much talent here wasted on programming. :-) -- --- 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
Re: [PHP] php/css and .htaccess [SOLVED]
On 9/21/06, tedd [EMAIL PROTECTED] wrote: tedd wrote: I embedded php code inside css and changed my .htaccess to read -- FilesMatch \.(htm|html|css)$ SetHandler application/x-httpd-php /FilesMatch -- so that the css file would be processed and executed by php. The end result was that everything worked and did what I wanted. However, FireFox / Mozillia won't accept a css file if a .htaccess file reads as indicated above. Christopher Weldon answered: That shouldn't be expected. The SetHandler only applies to the Apache handler side, as browsers should not be able to read those files (.htaccess). So, are you 100% positive that PHP is in fact processing the file? Christopher , this is what I'm sure of: 1. My css file has php code in it. 2. Without the .htaccess as noted above, the php code is not processed. 3. With the .htaccess as above, the php code *is* processed. 4. All (most popular) browsers, except for FF/Mozillia, allow php inside of css. Please note that, Kreme and Wind (sounds like a Rock group) provided the answer, which was to add a header to the css file, like so: header('Content-Type: text/css; charset=ISO-8859-1'); So, it wasn't that the browsers were reading the .htaccess file, but rather because of the .htaccess file FireFox/Mozillia required a header in the css file just to keep things straight (my understanding). 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. This is simply amazing, at least to me, and completes my next step toward world domination. :-. Many thanks gang for your most excellent and mondo kewl advice. tedd PS: So much talent here wasted on programming. :-) -- --- http://sperling.com http://ancientstones.com http://earthstones.com 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
Re: [PHP] php/css and .htaccess [SOLVED]
At 10:37 AM -0500 9/21/06, David Giragosian wrote: On 9/21/06, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] 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
Re: [PHP] php/css and .htaccess [SOLVED]
On 9/21/06, tedd [EMAIL PROTECTED] wrote: At 10:37 AM -0500 9/21/06, David Giragosian wrote: On 9/21/06, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] 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.
[PHP] php/css and .htaccess
Hi gang: I embedded php code inside css and changed my .htaccess to read -- FilesMatch \.(htm|html|css)$ SetHandler application/x-httpd-php /FilesMatch -- so that the css file would be processed and executed by php. The end result was that everything worked and did what I wanted. However, FireFox / Mozillia won't accept a css file if a .htaccess file reads as indicated above. Any ideas as to how to get FireFox to play nice? Thanks in advance for any replies. 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
Re: [PHP] php/css and .htaccess
tedd wrote: Hi gang: I embedded php code inside css and changed my .htaccess to read -- FilesMatch \.(htm|html|css)$ SetHandler application/x-httpd-php /FilesMatch -- so that the css file would be processed and executed by php. The end result was that everything worked and did what I wanted. However, FireFox / Mozillia won't accept a css file if a .htaccess file reads as indicated above. Any ideas as to how to get FireFox to play nice? Thanks in advance for any replies. tedd That shouldn't be expected. The SetHandler only applies to the Apache handler side, as browsers should not be able to read those files (.htaccess). So, are you 100% positive that PHP is in fact processing the file? -- Christopher Weldon, ZCE President CEO Cerberus Interactive, Inc. [EMAIL PROTECTED] 979.739.5874 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/css and .htaccess
Christopher Weldon wrote: tedd wrote: Hi gang: I embedded php code inside css and changed my .htaccess to read -- FilesMatch \.(htm|html|css)$ SetHandler application/x-httpd-php /FilesMatch -- so that the css file would be processed and executed by php. The end result was that everything worked and did what I wanted. However, FireFox / Mozillia won't accept a css file if a .htaccess file reads as indicated above. Any ideas as to how to get FireFox to play nice? Thanks in advance for any replies. tedd That shouldn't be expected. The SetHandler only applies to the Apache handler side, as browsers should not be able to read those files (.htaccess). So, are you 100% positive that PHP is in fact processing the file? -- Christopher Weldon, ZCE President CEO Cerberus Interactive, Inc. [EMAIL PROTECTED] 979.739.5874 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php FF needs header('Content-Type: text/css; charset=ISO-8859-1'); in css files. -- View this message in context: http://www.nabble.com/php-css-and-.htaccess-tf2308435.html#a6418835 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/css and .htaccess
On 20 Sep 2006, at 16:18 , tedd wrote: However, FireFox / Mozillia won't accept a css file if a .htaccess file reads as indicated above. Any ideas as to how to get FireFox to play nice? Yep, you need to specify header('Content-Type: text/css') This is because Mozilla/Firefox is, as far as I know, the only browser to insist on the content type for css files. Albeit it, mozilla.org is RIGHT on this one. -- How you have felt, o men of Athens, at hearing the speeches of my accusers, I cannot tell; but I know that their persuasive words almost made me forget who I was, such was the effect of the,; and yet they have hardly spoken a word of truth. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php