views:

40

answers:

2

hi

if i have 2 layout in my application how can change my default layout to other layout for some controller or action?

+2  A: 

Here you go:

$layout = Zend_Layout::getMvcInstance();
$layout->setLayout('otherlayout');

Where otherlayout is the name of the second layout (otherlayout.phtml in your layouts folder).

robertbasic
+3  A: 

robertbasic's answer is correct. You can also do the following inside of a controller action:

$this->_helper->layout->setLayout('otherlayout');
Mark
+1 for showing the helper too ;)
robertbasic