Creating RSS & Atom Feeds with Zend_Feed
Description
Use Zend_Feed to build a simple RSS / Atom feed from a dataset in your models.
Tags
atom, rss, zend_feed, zend_feed_writer
Use Zend_Feed to build a simple RSS / Atom feed from a dataset in your models.
atom, rss, zend_feed, zend_feed_writer
Well done.
Great Summary!
Thanks
Hi Jon,
I will say briefly that zendcasts is a service to humanity, truly outstanding. I was scared of zend framework until I found your site. Now I think I am ready to learn proper. Only thing I wanted to ask is I am in africa, Nigeria to be precise and I had 2 questions, our internet is not so good here so watching online is almost not possible so I used to use firefox addons to download the flash videos but looks like that don’t work anymore, is there anything you can do to help? Also you had a link on your site for folk that want to donate but can’t seem to find it. Not that I have a lot of cash but I just felt it would be good to donate and help no matter how small my help might be.
Thanks for your time.
joe
wow! Thanks Joseph. Actually, you can download the .mov files directly via the RSS feed. Mahbub even went through the trouble of collecting all the video urls on his blog:
http://www.mahbubblog.com/php/zend-casts-video-download-links/
Donations are still very welcomed
I simply put the donate button at the bottom of the about page. Maybe I should move it to the footer…
Great post. Love the new site
Well done Man!!!! I’m from Brazil, and I always see your videocasts!!!
Congratulations!!!!
Great! But…
I’ve added this into my CMS as you can see here http://www.balupton.com
Unfortunately… the atom feed is corrupted with ZF v1.10.8… the html of the entries just does not display and it looks like it has been stripped of all tags. Whereas the RSS feed displays beautifully. I’ve checked that this is not a feedburner issue as it happens with the zend framework code from this tutorial when using html posts… So I’m not sure…
I hope I’m not too picky, but…
Shouldn’t the response content-type be not text/html, but application/rss+xml or application/atom+xml?
I understand that this is an example and many things are irrelevant, but generally I think it would be valuable if you could promote all the Zend’s best practices, like MVC separation of concerns, TDD instead of var_dump() or die(), naming conventions for private methods, formatting according to coding standards, etc.
Also, maybe it would make more sense to use a ContextSwitch instead of manually disabling HTML body rendering in init()? In any case, $this->_helper->layout() can be used instead of the Singleton accessor.
BTW, you should have a look at get_object_vars()
.
In short – less “plumbing” and more quality would definitely help set higher standards for other Zend Framework programmers.
Hey Olek,
you’re definitely not being too picky! good call on the get_object_vars(), this would’ve helped with the dynamic properties. In terms of the ContextSwitch, again I think you make a great point there. I really appreciate the feedback and I’ll try and make more use of the zend_test infrastructure in future videos.
Hi,
I followed the tutorial, but on my server, if I go on the link: miodominio.it/feed/rss, I see a blank page without any error.
What’s wrong?
thanks
hello
great post, congratulations, but,
I have a problem with the code I have these errors and do not know what to do if you can help me please thanks
message is:
An error occurred
Application error
Exception information:
Message: Method: setDataModified does not exist and could not be located on a registered Extension
Stack trace:
#0 [internal function]: Zend_Feed_Writer_Feed_FeedAbstract->__call(‘setDataModified’, Array)
#1 /Applications/XAMPP/xamppfiles/site/application/controllers/FeedController.php(28): Zend_Feed_Writer_Feed->setDataModified(1323025013)
#2 /Applications/XAMPP/xamppfiles/site/application/controllers/FeedController.php(65): FeedController->getFeed()
#3 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Controller/Action.php(513): FeedController->rssAction()
#4 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch(‘rssAction’)
#5 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#7 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#8 /Applications/XAMPP/xamppfiles/site/public/index.php(26): Zend_Application->run()
#9 {main}
Request Parameters:
array (
‘controller’ => ‘feed’,
‘action’ => ‘rss’,
‘module’ => ‘default’,
)
Your comment is awaiting moderation.
hello
great post, congratulations, but,
I have a problem with the code I have these errors and do not know what to do if you can help me please thanks
message is:
An error occurred
Application error
Exception information:
Message: Method: setDataModified does not exist and could not be located on a registered Extension
Stack trace:
#0 [internal function]: Zend_Feed_Writer_Feed_FeedAbstract->__call(‘setDataModified’, Array)
#1 /Applications/XAMPP/xamppfiles/site/application/controllers/FeedController.php(28): Zend_Feed_Writer_Feed->setDataModified(1323025013)
#2 /Applications/XAMPP/xamppfiles/site/application/controllers/FeedController.php(65): FeedController->getFeed()
#3 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Controller/Action.php(513): FeedController->rssAction()
#4 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch(‘rssAction’)
#5 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#7 /Applications/XAMPP/xamppfiles/lib/php/pear/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#8 /Applications/XAMPP/xamppfiles/site/public/index.php(26): Zend_Application->run()
#9 {main}
Request Parameters:
array (
‘controller’ => ‘feed’,
‘action’ => ‘rss’,
‘module’ => ‘default’,
)