Re: php/css and .htaccess [SOLVED]

From: Date: Thu, 21 Sep 2006 13:48:08 +0000
Subject: Re: php/css and .htaccess [SOLVED]
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-242029@lists.php.net to get a copy of this message
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

« previous php.general (#242029) next »