To get layout object
- within view script
$layout = $this->layout()
- within action controller
$layout = $this->_helper->layout() $layout = $this->_helper->getHelper(‘Layout’)->getLayoutInstance()
- within bootstrap
$layout = $bootstrap->getResource(‘Layout’);
- elsewhere
$layout = Zend_Layout::getMvcInstance();
To assign variable to layout object
$layout->var = ‘value’; $layout->assign(‘var’, ‘value’);
To enable or disable layout
$layout->enableLayout(); $layout->disableLayout();
To enable or disable layout using CLI
zf enable layout zf disable layout