CodeIgniter Forums
How can I create a custom XML feed? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How can I create a custom XML feed? (/showthread.php?tid=63193)



How can I create a custom XML feed? - alexandervj - 10-05-2015

Hi,

I need to create a custom XML feed so that our jobs page gets indexed in simply hired. RSS-XML feeds are not acceptable for submitting jobs, they have their own XML tags to use here...
http://www.seochat.com/c/a/search-engine-optimization-help/optimize-job-listings-for-simply-hired-search/

I dont really know anything about XML or creating an XML feed. It looks like they give you just about everything you need in the article. But how do I create the feed with CodeIgniter? The rest of the site is created with CodeIgniter. 
Thanks for your help



RE: How can I create a custom XML feed? - CroNiX - 10-05-2015

Basically the same way as you genterate a html page with codeigniter...grab data, manipulate it, output it. Except you'd just be outputting xml instead of html.

You can use the DOMDocument object/methods: http://www.phpeveryday.com/articles/PHP-XML-Creating-XML-Document-P413.html


RE: How can I create a custom XML feed? - PaulD - 10-05-2015

I have not done an XML feed in codeigniter but I am sure you will have no problems at all.

XML is just an alternative markup language like HTML (but not HTML) which was designed specifically for transferring data.

So your controller just collects your data as it would for a normal page, and loads a view that has xml markup rather than html markup. The url to that controller is then your feed url. If you visit it in a browser it is not very pretty, but it is not HTML.

Hope that helps,

Paul.


RE: How can I create a custom XML feed? - alexandervj - 10-05-2015

Thanks for the replies, they were very helpful. I think I understand it a little better now. I guess I'll just give it a try and see what happens


RE: How can I create a custom XML feed? - AjitK29 - 10-08-2015

Refer the following tutorials, might you will be able to build a feed for any custom website.

http://code.tutsplus.com/tutorials/build-an-rss-20-feed-with-codeigniter--net-7811
http://derekallard.com/index.php/blog/post/building-an-rss-feed-in-code-igniter/