【发布时间】:2011-11-24 14:33:48
【问题描述】:
我正在尝试更改 ZF 应用程序中布局的原始路径。
$viewsPath = '../application/_layouts';
$options = array('layoutPath' => $viewsPath, 'layout' => 'layout');
Zend_Layout::startMvc();
//Initializing Zend_View
$view = Zend_Layout::getMvcInstance()->getView();
$view->setBasePath($viewsPath);
ZF 试图在 /application/_layouts/scripts 中查找布局
Zend_View_Abstract 中的addBasePath() 使$this->addScriptPath($path . 'scripts');
我需要使用 /application/_layouts/layout.phtml 而不是 /application/_layouts/scripts/layout.phtml
如何让 ZF 在不重新加载 Zend_View_Abstract::addBasePath() 的情况下忽略“脚本”文件夹?
【问题讨论】:
-
哦!抱歉。我在上面花了 2 个小时 :( 但问题出在 Zend_Layout::startMvc($options);
-
替代方案 - 如果您使用 zend_application - 您可以使用 ini 指令:
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"并根据您的需要更改路径
标签: zend-framework