Jump to content

php in other file extensions


amitrus

Recommended Posts

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? 
Link to comment
https://forums.phpfreaks.com/topic/14587-php-in-other-file-extensions/
Share on other sites

.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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.