Zend框架 - 加载模块中的视图助手

5

我正在使用Zend Framework创建一个模块化应用程序,但是我很难让特定于模块的视图助手加载。

我的目录结构如下...

application
---configs  
---controllers  
---forms  
---layouts  
---models  
---modules  
------user  
---------controllers  
---------forms  
---------modules  
---------views  
------------filters
------------helpers  
---------------currentUser.php  
------------scripts  
---------Bootstrap.php  
---views  
---Bootstrap.php  

基本上我想访问包含在currentUser.php中的视图助手,但是当我放置时。
<?php echo $this->currentUser(); ?>  

我收到一个错误,说找不到文件。

我需要在我的配置文件中添加什么才能加载这些帮助程序?

我的配置大致是这样的...

Autoloadernamespaces[] = "Zend_"
Autoloadernamespaces[] = "Default_"
Autoloadernamespaces[] = "User_"

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

includePaths.library = APPLICATION_PATH "/../library"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

resources.frontController.controllerDirectory = APPLICATION_PATH    "/controllers"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

resources.view[] =
resources.modules[] = 
1个回答

4

我已经解决了...

我所需要做的就是在我的配置文件中添加这一行:

user.resources.view.helperPath.Zend_View_Helper = APPLICATION_PATH "/modules/user/views/helpers"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接