Re: php/css and .htaccess [SOLVED]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux