SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    PHP code in a XML document?

    Well, what if you wanted something like this?

    <?xml version="1.0"?>

    <dog>
    <breed><?php echo "Labrador"; ?></breed>
    </dog>

    When one tries to parse this with PHP (by adding "AddType application/x-httpd-php .xml" in httpd.conf) the damn thing reports a parse error on line 1 (due to the "<?" in the "<?xml" tag, of course). I worked around this by simply disabling "short_open_tag" in php.ini, but this won't hold up when I upload the thing to my host.

    Is there another way to generate XML docs with PHP? Please help!
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  2. #2
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try making a .htaccess with the following in the same directory as the XML file:

    php_var short_open_tag 0

  3. #3
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Oh, I tried this - it worked! I forgot to thank you - Thanks!
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •