Mortekai Posted September 5, 2009 Share Posted September 5, 2009 I have a XML file that I want to create a RSS file for, but I am not quite sure what to do or how.... I tried using XSLT to transform the XML file, but I am not sure thats the right approach? Link to comment https://forums.phpfreaks.com/topic/173249-xml-to-rss/ Share on other sites More sharing options...
Mortekai Posted September 5, 2009 Author Share Posted September 5, 2009 Ok, I am trying this, but I am not getting any results.... <rss version="2.0"> <channel> <title>W3Schools Home Page</title> <link>http://www.w3schools.com</link> <description>Free web building tutorials</description> <?php header('Content-type: text/html; charset=utf-8'); $xml = simplexml_load_file('filmer.xml'); foreach($xml->filmer->film as $film) { echo"<item>"; echo "<title>".utf8_decode($film->title)."</title>"; echo "<link>".utf8_decode($film->picture)."</link>"; echo "<description>".utf8_decode($film->title)."</description>"; echo"</item>";} ?> </channel> </rss> Link to comment https://forums.phpfreaks.com/topic/173249-xml-to-rss/#findComment-913239 Share on other sites More sharing options...
Mortekai Posted September 5, 2009 Author Share Posted September 5, 2009 Not surprising as you can not use PHP inside a xml file...*silly me* Link to comment https://forums.phpfreaks.com/topic/173249-xml-to-rss/#findComment-913242 Share on other sites More sharing options...
Mortekai Posted September 5, 2009 Author Share Posted September 5, 2009 This is really driving me nuts... Link to comment https://forums.phpfreaks.com/topic/173249-xml-to-rss/#findComment-913260 Share on other sites More sharing options...
Mortekai Posted September 5, 2009 Author Share Posted September 5, 2009 <?xml version="1.0" encoding="ISO-8859-1"?> <filmer> <film> <title>Testfilm</title> <genre>Action</genre> <length>96</length> <rating>4</rating> <picture>http://static.lovefilm.se/img/cover/movie/small/Outlander/51284.jpg</picture> <year>2006</year> </film> </filmer> Need to be transformed to... <?xml version="1.0" encoding="ISO-8859-1" ?> <rss version="2.0"> <channel> <title>Lämplig titel</title> <link>Länk</link> <description>Beskrivning</description> <item> <title>Testfilm</title> <link>http://www.w3schools.com/rss</link> <description>Action</description> </item> </channel> </rss> Link to comment https://forums.phpfreaks.com/topic/173249-xml-to-rss/#findComment-913280 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.