2011-03-18 141 views
1

所以我加入這行來bootstrap.php中Zend框架的引導錯誤

protected function _initSetDefaultKeywords() { 
    $view = $this->bootstrap('view')->getResource('view');   
    $view->keywords = 'default keywords'; 
} 

,但隨後將顯示錯誤

Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "view" not found 

所以我嘗試添加resources.view[] = ""到的application.ini,但隨後當發生這種情況時,我的所有助手突然停止工作

* s 

An error occurred 
Application error 
Exception information: 

    Message: Plugin by name 'X' was not found in the registry 

我該如何解決這個問題

當前app.ini

[production] 
phpSettings.display_startup_errors = 0 
phpSettings.display_errors = 0 
includePaths.library = APPLICATION_PATH "/../library" 
bootstrap.path = APPLICATION_PATH "/Bootstrap.php" 
bootstrap.class = "Bootstrap" 
appnamespace = "Application" 
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" 
resources.frontController.params.displayExceptions = 0 
resources.frontController.defaultControllerName = "view" 
resources.view[] = "" 

[staging : production] 

[testing : production] 
phpSettings.display_startup_errors = 1 
phpSettings.display_errors = 1 

[development : production] 
phpSettings.display_startup_errors = 1 
phpSettings.display_errors = 1 
resources.frontController.params.displayExceptions = 1 
+0

你可以發佈您當前的application.ini文件? – emaillenin 2011-03-18 17:58:04

回答

5

試試這個在你的application.ini:

resources.view[] = "" 
resources.view.helperPath.MyNamespace_View_Helper = "MyNamespace/View/Helper" 

請務必更改MyNamespace_View_Helper您ViewHelpers的實際前綴。

您可能還需要的路徑添加到您的AutoloaderNamespaces變量:

autoloaderNamespaces.MyNamespace = "MyNamespace_" 
+0

您不需要第一個配置行,第二個設置視圖資源的配置數組。 – Phil 2011-03-29 03:57:03

+0

@菲爾 - 謝謝,我還試圖給@kamikaze_pilot引用線路應該去的地方。 – leek 2011-03-29 08:12:53