Help - Search - Members - Calendar
Full Version: php include within xml?
Movable Type Community Forum > Additional Resources > Tips and Tricks
drew
anyone know of a way to get an xml (rss 2) index template to display html from a php include?

i'm using a PHP include in my MTExtendedEntry field which renders fine for all blog entries since they're all php, but my xml file just shows the PHP include code.

i'm just trying to have my RSS feed show the data that i'm including in my blog post.

samples:
http://www.dawnanddrew.com/archives/001100.php
http://www.dawnanddrew.com/rss2.xml

thanks for any help or suggestions...
imabug
that's because your (or your host's) web server doesn't know to parse the PHP in an .xml file.

if you really want the PHP code in your XML file to be parsed, change the extension to .php.
drew
brilliant!! you made me realize that it's doable via htaccess.

thanks!

CODE
RemoveHandler .xml
AddType application/x-httpd-php .php .html .htm .xml


then this goes at the top of the xml file
CODE
<?php
header("Content-Type: text/xml");
echo '<?xml version="1.0"?>';
?>


...also thanks to pete wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.