如何在模块zend zf1中设置布局

时间:2014-06-02 17:05:13

标签: zend-framework

我的项目是:

var
 -www
   -appwar
     -s1
       -application
         -controllers
         -models
         -modules
           -quests
            -controllers
            -models
            -views
              -scripts
                main.phtml
         -views
          -scripts
            layout.phtml

在主应用程序中我使用layout.phtml但是当我添加模块并在控制器中我编码

$this->_helper->layout->setLayout('main');

一切都很好,但我想使用主项目的布局,当我改变

$this->_helper->layout->setLayout('layout'); or 
$this->_helper->layout->setLayout('/application/views/scripts/layout');

不起作用:(你知道我该怎么办?

1 个答案:

答案 0 :(得分:1)

在setLayout():

之前尝试此操作
// If APPLICATION_PATH == '/var/www/appwar/s1/application'
$this->_helper->layout->setLayoutPath(APPLICATION_PATH . '/views/scripts');