0

嗨,我需要有关 zend 布局加载器的帮助,以下是我的代码,它不能正常工作!

public function preDispatch(){

    $bootstrap = $this->getActionController()->getInvokeArg('bootstrap');
    $config = $bootstrap->getOptions();
    Zend_Registry::set('config', $config);
    $module = $this->getRequest()->getModuleName();
    $controller = $this->getRequest()->getControllerName();
    $action = $this->getRequest()->getActionName();
}

谢谢

4

1 回答 1

0
    public function preDispatch(){

    $bootstrap = $this->getActionController()->getInvokeArg('bootstrap');
    $config = $bootstrap->getOptions();
    Zend_Registry::set('config', $config);
    $module = $this->getRequest()->getModuleName();
    $controller = $this->getRequest()->getControllerName();
    $action = $this->getRequest()->getActionName();

    $layoutScript = "layout";
    if (isset($config[$module]['resources']['layout']['layout'])) {
        $layoutScript = $config[$module]['resources']['layout']['layout'];
    }
    $this->getActionController()->getHelper('layout')->setLayout($layoutScript);
}

谢谢

于 2012-07-24T12:16:33.597 回答