2011-07-24 74 views
1

我的application.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" 
test.bootstrap.path = APPLICATION_PATH "/modules/test/Bootstrap.php" 
test.bootstrap.class = "Test_Bootstrap" 

appnamespace = "Application" 

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" 
resources.frontController.params.displayExceptions = 0 
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" 

resources.view.basePath = APPLICATION_PATH "/views/" 

resources.view[] = 
test.resources.view[] = 

db.adapter = "PDO_MYSQL" 
db.params.dbname = "money" 
db.params.username = "root" 
db.params.password = "**************" 

resources.modules[] = 
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 
[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 

应用程序/模块/测试/ bootstrap.php中

class Test_Bootstrap extends Zend_Application_Module_Bootstrap 
{ 
    protected function _initLeftMenu() 
    { 
     $this->bootstrap('View'); 
     $view = $this->getResource('View'); 
     $view->render('index/_left_menu.phtml'); // <-- here error 
    } 
} 

$view->render

Fatal error: Uncaught exception 'Zend_View_Exception' with message 'no view script directory set; unable to determine location for view script' in C:\ZendFramework\library\Zend\View\Abstract.php:973 Stack trace: #0 C:\ZendFramework\library\Zend\View\Abstract.php(884): Zend_View_Abstract->_script('_left_menu.phtm...') #1 E:\www\money2\application\modules\test\Bootstrap.php(19): Zend_View_Abstract->render('_left_menu.phtm...') #2 C:\ZendFramework\library\Zend\Application\Bootstrap\BootstrapAbstract.php(667): Test_Bootstrap->_initLeftMenu() #3 C:\ZendFramework\library\Zend\Application\Bootstrap\BootstrapAbstract.php(620): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('leftmenu') #4 C:\ZendFramework\library\Zend\Application\Bootstrap\BootstrapAbstract.php(584): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #5 C:\ZendFramework\library\Zend\Application\Resource\Modules.php(124): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() #6 C:\ZendFramework\library\Zend\Application\Resource\Mod in C:\ZendFramework\library\Zend\View\Abstract.php on line 973

任何想法出了问题?

+1

你为什么不开始与大写字母的句子? – takeshin

+0

@takeshin不好吗? =) – Subdigger

+1

有人需要稍后编辑此问题以符合SO标准。这是一个真实的人群,其他人一遍又一遍地阅读你的帖子。你可以考虑一些额外的微观时间来正确地写出问题,因为我们正在花时间为你的问题找出答案。 – takeshin

回答

0

找到自己的救赎: 的application.ini

test.resources.view.basePath = APPLICATION_PATH "/modules/test/views/" 
+0

现在工作,但最终你会陷入困境。 – Xerkus

+0

@Xerkus告诉我为什么?这个问题,正如我在上面所说的:_no查看脚本目录set_。以任何方式我只桅杆设置目录。 ather事情正常 – Subdigger

+0

应用程序资源View取代ViewRenderer助手和视图实例。因此,当您在模块中使用它时,它会替换在主引导中配置的视图实例。 – Xerkus

0

删除test.resources.view[] =

模块查看资源取代了主引导程序视图。

提示:
$this->getApplication();模块引导返回主引导
用它来引导和检索视图。

class Test_Bootstrap extends Zend_Application_Module_Bootstrap 
{ 
    protected function _initLeftMenu() 
    { 
     //main bootstrap, injected by modules resource 
     $bootstrap = $this->getApplication(); 
     $bootstrap->bootstrap('View'); 
     $view = $bootstrap->getResource('View'); 
     $view->render('index/_left_menu.phtml'); // <-- here error 
    } 
} 

btw,bootstrap不是一个渲染东西的好地方。考虑将它移到更合适的地方。例如,动作助手。
还要检查this blog post

+0

将在今天晚上尝试给你建议 – Subdigger

+0

同样的问题。 _no查看脚本目录集;无法确定视图的位置script_ – Subdigger

+0

@Subdigger如何检索您的视图实例? – Xerkus