How to change a Zend Layout in module/controller to layout stored in another module?
I am working in the error controller of my default module but I h开发者_开发知识库ave other modules/controllers that have errors. Their errors are sent to the default/error controllers but the layouts that are used are the ones from the module that threw the error. I want to only use the default modules layout for all errors.
Why not use helper:
public function init()
{
$this->_helper->layout->setLayout('front');
}
hmmm???
<?php
class ErrorController extends Zend_Controller_Action
{
public function init()
{
parent::init();
$layout = Zend_Layout::getMvcInstance();
// Set a layout script path:
$layout->setLayoutPath('/path/to/you/default/module/layouts');
// choose a different layout script:
$layout->setLayout('foo');
}
}
精彩评论