Andrew Havens Ruby Developer

How to switch layout files in Zend Framework

18 November 2010

I can never remember how to do this, so I’m posting it here for future reference.

This is how you can switch layout files in Zend Framework:

// Within controller
$this->_helper->_layout->setLayout('other-layout') //other-layout.phtml

//Within view script
<?php $this->layout()->setLayout('other-layout'); ?>