Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Framework - Loading View Helpers from Modules

I am putting together a modular application in Zend Framework and am struggling to get module specific View Helpers to load.

My directory structure is like this...

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

basically I want to access the view helper that is contained in currentUser.php but when I put

<?php echo $this->currentUser(); ?>  

I get an error stating that the file cannot be found.

What do I need to add to my config file to load these helpers?

My config is something like this...

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[] = 
like image 789
Martin Avatar asked Oct 14 '22 02:10

Martin


1 Answers

I have worked it out...

All I need to do was to add this line to my config file:

user.resources.view.helperPath.Zend_View_Helper = APPLICATION_PATH "/modules/user/views/helpers"
like image 64
Martin Avatar answered Oct 28 '22 22:10

Martin