Is there a simple way of just enable a layout for the actions of a controller, instead of disabling it in all other actions of other controllers in Zend?
Asked
Active
Viewed 319 times
1 Answers
3
class IndexController extends Zend_Controller_Action
{
public function init()
{
// For all actions
Zend_Layout::getMvcInstance()->disableLayout();
}
public function myAction()
{
// For specific action
Zend_Layout::getMvcInstance()->setLayout('my');
}
// ...
}

Alex Pliutau
- 21,392
- 27
- 113
- 143
-
And the actions that don't use the layout, need some code too? – Cristiano Santos Jan 17 '12 at 13:58
-
So I need to disable the layout in all other actions? Is this better then making a default empty layout to be used on all other actions? – Cristiano Santos Jan 17 '12 at 14:08
-
I don't know about your application. What is better you should know better than me. – Alex Pliutau Jan 17 '12 at 14:11
-
Ok, in my case, I prefer to make a layout that just have "layout()->content ?>" for all actions an then specify the other layout manually on the other actions. Thanks for the help ;) – Cristiano Santos Jan 17 '12 at 14:16