2012年7月12日星期四

MaltBlue.com: Zend Framework - How To Implement RSS Feeds the Easy Way


On the MaltBlue blog Matt Setter has a new tutorial posted about creating RSS feeds quickly and easily with the help of the Zend Framework and context switching.



Ever wanted to know how to take an existing Zend Framework application where you have posts, records, news or anything else stored in a data source and updated regularly, and make it available as a feed for your users that they can subscribe to? Well today, that's what I want to show you. Recently, during the development of the burgeoning PHP cloud development casts site, I had just that situation.


He shows you how to set up some of the routing for the RSS and Atom feeds, pointing them to specific module/controller/action paths for handling. He then creates a "_getFeed()" method that pulls together the needed content and uses the Zend_Feed_Writer_Feed component to create the feed of the correct type. This is then exported, returned and - thanks to a bit more configuration - turned into a correctly-formatted feed.

没有评论:

发表评论