Media RSS and ZF – Part 2

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');

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="" xmlns:av="">
   <title><?php echo $this->somevar ?></title>
   other media rss elements

Leave a Reply

Your email address will not be published. Required fields are marked *