Zend framework 如何将模块/控制器中的Zend布局更改为另一个模块中存储的布局?

Zend framework 如何将模块/控制器中的Zend布局更改为另一个模块中存储的布局?,zend-framework,layout,Zend Framework,Layout,我在默认模块的错误控制器中工作,但我的其他模块/控制器有错误。它们的错误被发送到默认/错误控制器,但使用的布局是引发错误的模块中的布局。我只想对所有错误使用默认模块布局。为什么不使用帮助器: <?php class ErrorController extends Zend_Controller_Action { public function init() { parent::init();

我在默认模块的错误控制器中工作,但我的其他模块/控制器有错误。它们的错误被发送到默认/错误控制器,但使用的布局是引发错误的模块中的布局。我只想对所有错误使用默认模块布局。

为什么不使用帮助器:

    <?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');
        }
    }
public function init()
{
     $this->_helper->layout->setLayout('front');
}