amitrus Posted July 14, 2006 Share Posted July 14, 2006 I am currently trying to include php code in a .xml file. The file would look something like this <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <title></title> <link></link> <description></description> <language>en-us</language> <copyright></copyright> <item><title></title> <description> <?php echo $value; ?> </description> </item> </channel></rss> But I need to get my server to see the php in the .xml file. (The extension has to be .xml) How can I do this? I've been fooling around with the .htaccess file, but still can't make my server see the php in a .xml file (I did manage, however, to make it see the php in a .html file by changing the .htaccess file.). Can anyone help me? Quote Link to comment Share on other sites More sharing options...
shocker-z Posted July 14, 2006 Share Posted July 14, 2006 I think you have to have a PHP file but then give the file a header of an xml file..Maby this site is some help?http://www.xml.com/pub/a/2003/03/19/dive-into-xml.htmlRegardsLiam Quote Link to comment Share on other sites More sharing options...
steelmanronald06 Posted July 14, 2006 Share Posted July 14, 2006 go into your apache and add .xml as an extension that php will parse ;) Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 14, 2006 Share Posted July 14, 2006 Just put this in a [b].htaccess[/b] file:[code]AddType application/x-httpd-php .xml[/code] Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 14, 2006 Share Posted July 14, 2006 It would be better to do if via apache i think...doesn't .htaccess slow things down? Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 14, 2006 Share Posted July 14, 2006 Well in the Apache config then, I didn't have a choice in my hosting environment because i didn't have access to apache config, but whatever suits. Quote Link to comment Share on other sites More sharing options...
Koobi Posted July 14, 2006 Share Posted July 14, 2006 .htaccess is a part of Apache.you don't need to access any apache configs. just add what ShogunWarrior posted in an .htaccess file and save that .htaccess file to the working directory.but your XML file isn't valid to begin with.you would have to surround your XML in CDATA tags 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.