2011-11-02 32 views
0

我試圖在我的ZF應用程序中更改佈局的原始路徑。在Zend Framework中更改原始佈局路徑

$viewsPath = '../application/_layouts'; 
$options = array('layoutPath' => $viewsPath, 'layout' => 'layout'); 
Zend_Layout::startMvc(); 

//Initializing Zend_View 
$view = Zend_Layout::getMvcInstance()->getView(); 
$view->setBasePath($viewsPath); 

ZF試圖找到/應用/ _layouts /腳本

在Zend_View_Abstract來解析addBasePath()使得$this->addScriptPath($path . 'scripts');

我需要自行/應用/ _layouts的使用/application/_layouts/layout.phtml佈局/ 腳本 /layout.phtml

如何讓ZF在不重新加載的情況下忽略'scripts'文件夾Zend_View_Abstract::addBasePath()

+0

哦!對不起。我已經花了2個小時對它:( 但問題出現在Zend_Layout :: startMvc(** $ options **); – aloneibreak

+0

替代 - 在你使用zend_application的情況下 - 你可以使用ini-directive:'resources.layout .layoutPath = APPLICATION_PATH「/ layouts/scripts /」'並根據需要更改路徑 – Sam

回答

0

如果您正在使用標準Zend_Application_Bootstrap,你可以在你的application.ini設置這些變量和框架將完成剩下的:

resources.view.helperPath      = APPLICATION_PATH "/views/helpers" 
resources.layout.layoutPath     = APPLICATION_PATH "/views/layouts"