[Typo3-dev] OT: XP SP2 impacts

Ingmar Schlecht ingmars at web.de
Sat Jun 5 19:25:10 CEST 2004


Peter Niederlag wrote:
> Hi,
> 
> Martin T. Kutschker schrieb am  5.06.2004 um 10:45 Uhr CEST
> 
> 
>>Peter Niederlag wrote:
>>
>>>Hi Patrick,
>>>
>>>I just noticed some problems with content-type header in mozilla.
>>>A customers webserver is configured to parse .css with php. PHP by
>>>default will send a content-type text/html. So .css files will be
>>>sent as text/html.
>>
>>Can't PHP setup so that the default mime type changes with the 
>>extension? It's nice to run CSS with PHP, but it's dull to send a
>>wrong mime type.
> 
> 
> I just had a quick look into this. I didn't find a solution other than
> put in theree lines of custom php-code in the beginning of hte .css
> 
> <?php
> header"content-type text/html");

I guess you meant text/css.

> ?>
> 
> Is there some "mime-magic" for php?

I didn't look into this, but I think you could easily do it yourself 
using the 'auto_prepend_file' option of the php.ini.

Example:
auto_prepend_file = mimeHeader.php


Contents of mimeHeader.php:

<?php

$theFileExtension = someCodeGettingTheFileExtension();

switch($theFileExtension) {
	case 'css':
		header('content-type text/css');
	break;
	case 'png':
		header('content-type image/png');
	break;
}

?>

cheers,
Ingmar




More information about the TYPO3-dev mailing list