I created an RSS feed page with PHP and tried to run it through through a JavaScript RSS reader code (http://www.zazar.net/developers/jquery/zrssfeed/ )
It does not recognize the PHP file as having XML code. Though I copied the rendered code generated from PHP and added it in an XML file and it worked.
Is there a way to change this PHP file extension into an XML? Or make the PHP file visible to the above JavaScript code?
I tried using the .htaccess to change the file type (as there are tutorials all over covering that) but it did not work.
Can you recommend anything?
This is my code:
<?php
header ("Content-Type:text/xml");
$xml = new SimpleXMLElement('<xml/>');
for ($i = 1; $i <= 8; ++$i) {
$track = $xml->addChild('track');
$track->addChild('path', "song$i.mp3");
$track->addChild('title', "Track $i - Track Title");
}
print($xml->asXML());
?>