phpmlx Posted February 19, 2008 Share Posted February 19, 2008 I run Apache 2.2 and PHP 5.2.5 on Windows. I have started using PHP to generate dynamic css and images. In Apache I have added the line AddType application/x-httpd-php .css In PHP I have set default_mimetype=""; This now works fine. However, (and obviously), no content type is sent for any PHP processed file (css, php etc). This is generally not a problem, but I would like to be able to set a default so that ALL ".css" automatically get mimetype=text/css and all ".php" get mimetype=text/html unless specified otherwise. In otherwords, is it possible to make the default_mimetype configuration extension sensitive? (I am aware of the header("Content-Type:") php function but do not want to specify mime-types in each file.... Any help / guidance appreciated! Chrs, Alan Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 19, 2008 Share Posted February 19, 2008 you need to use templates first you create your header info then add it to the index page with a include("header.php"); with the header page you add your mime types................. you also add your css to the header/index page.......... Quote Link to comment Share on other sites More sharing options...
phpmlx Posted February 19, 2008 Author Share Posted February 19, 2008 Thank you for the suggestion. I assume by templates you're suggesting building the website using templates. That is fine (and what I do anyway) but not how I want to go ahead with this! I was wondering if PHP has any method to automatically detect and send the correct default_mimetype? Similar to Apache's AddType configuration (which was the only way I could determine of processing CSS extension files with PHP). Hope this is possible! Alan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.