XML and PHP in same document: Config suggestions?

From: Date: Wed, 28 Nov 2001 16:39:59 +0000
Subject: XML and PHP in same document: Config suggestions?
Groups: php.dev 
Request: Send a blank email to php-dev+get-71938@lists.php.net to get a copy of this message
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

« previous php.dev (#71938) next »