I've come up with a two-part setup in Apache to enable special file extensions for processing PHP in XML documents. I'm wondering what you guys think, and what I can do to improve the setup. (This is based on the PHPDEV development server from www.firepages.com.au .)
Here's the first part, lines for a .htaccess file in c:/phpdev/www : [CODE] AddType application/x-httpd-php .pxml .pxsl .pxhtml .pmml .psvg php_value auto_prepend_file c:/phpdev/www/mimeOverride.php # Added to force the document to allow for multiple mimetypes. #Alex Vincent added 11-26-01 php_value short_open_tag off # Added to force <?php...?> instead of <?...?>; assists with XML documents and XML processing instructions. [/CODE] The second part is the mimeOverride.php file I referenced earlier: [CODE] <?php $extension = strrchr($SCRIPT_NAME, "."); switch ($extension) { case ".pxml": header("Content-type: text/xml"); break; case ".pxsl": header("Content-type: text/xsl"); break; case ".pmml": header("Content-type: application/mathml+xml"); break; case ".psvg": header("Content-type: image/svg+xml"); break; case ".pxhtml": switch ($mimeType) { case "text/xml": case "application/xml": case "application/xhtml+xml": header("Content-type: $mimeType"); break; } break; } ?> [/CODE] Anyone care to suggest additional mime-types and file extensions, fix bugs in the code, or streamline it? ------------------ [i]"The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."[/i] -- Alexander J. Vincent, June 30, 2001 http://www.jslab.org -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]