Re: php/css and .htaccess [SOLVED]
| From: | David Giragosian | Date: | Thu, 21 Sep 2006 15:37:42 +0000 |
| Subject: | Re: php/css and .htaccess [SOLVED] | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242031@lists.php.net to get a copy of this message | ||
On 9/21/06, tedd <tedd@sperling.com> wrote:
tedd wrote: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?? DavidendI 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. Thefileresult was that everything worked and did what I wanted. However, FireFox / Mozillia won't accept a css file if a .htaccessChristopher Weldon answered: That shouldn't be expected. The SetHandler only applies to the Apachereads as indicated above.(.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.comhandler side, as browsers should not be able to read those files