Iluvatar+ Posted January 6, 2012 Share Posted January 6, 2012 I have a blog i created and i want to be able to create a page that can deal with the rss feeds. I have never done it before so if any one can give me some sugestions thats would be great. Quote Link to comment https://forums.phpfreaks.com/topic/254478-set-up-a-simple-rss-feeds-using-php/ Share on other sites More sharing options...
sandeep529 Posted January 6, 2012 Share Posted January 6, 2012 Do you want to provide an rss feed to the user, or you want to use data from external RSS feeds to be displayed in your site? RSS is basically xml so what you will need to do will be XML parsing or XML generation...you can try SimpleXML or DOM XML functions... There is also a class I have created for xml parsing/generation/manipulation called crXml, the usage of which I have outlined in the thread http://www.phpfreaks.com/forums/index.php?topic=351131.msg1657792#msg1657792 Quote Link to comment https://forums.phpfreaks.com/topic/254478-set-up-a-simple-rss-feeds-using-php/#findComment-1304807 Share on other sites More sharing options...
Iluvatar+ Posted January 6, 2012 Author Share Posted January 6, 2012 I want it to provide an rss feed to the user for each blog post. Quote Link to comment https://forums.phpfreaks.com/topic/254478-set-up-a-simple-rss-feeds-using-php/#findComment-1304809 Share on other sites More sharing options...
sandeep529 Posted January 6, 2012 Share Posted January 6, 2012 Will this work...? This uses the class I mentioned in previous message.... $blog = array( array('name'=>'entry 1','title'=>'title 1','type'=>'misc') , array('name'=>'entry 2','title'=>'title 2','type'=>'misc2','anotherEntry'=>'entry content') ); include 'crXml.php'; $crxml = new crxml; foreach($blog as $c => $entry) { foreach($entry as $k=>$v) { $crxml->item[$c]->$k = $v; } } echo $crxml->xml(); Outputs <?xml version="1.0" encoding="UTF-8"?> <item> <name>entry 1</name> <title>title 1</title> <type>misc</type> </item> <item> <name>entry 2</name> <title>title 2</title> <type>misc2</type> <anotherEntry>entry content</anotherEntry> </item> Just replace the blog array with any content from your blog..... Quote Link to comment https://forums.phpfreaks.com/topic/254478-set-up-a-simple-rss-feeds-using-php/#findComment-1304850 Share on other sites More sharing options...
Iluvatar+ Posted January 6, 2012 Author Share Posted January 6, 2012 Thanks worked like a charm! Quote Link to comment https://forums.phpfreaks.com/topic/254478-set-up-a-simple-rss-feeds-using-php/#findComment-1304854 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.