Here’s the promised chunk of code making the most simple bridge between Zend Framework and Media RSS.
Step 1
Just add a simple action in a controller:
class IndexController extends Zend_Controller_Action { public function indexAction() { $this->getResponse()->setHeader('Content-Type', 'application/xml'); $this->view->somevar = 'some value'; echo $this->view->render('index/index.xml'); $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); } } |
Step 2
After you’ve setup the xml file as a view script – you can simply access it as a normal Zend Framework view:
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:av="http://www.searchvideo.com/schemas/av/1.0"> <channel> <title><?php echo $this->somevar ?></title> ... other media rss elements ... </channel> </rss> |
Related posts: