|
|||
|
Hi
I made my custom view helper andto use them I have to add my path to the view object: PHP Code:
But, the problem is that I have to do this in every action where I want to use my helper, and I can't find a way to set this path once, say in a bootstrap.... Is there any easy and fun ways of doing this? and not having to add the path in every action..Thanks. |
|
|||
|
If you're using the ViewRenderer it couldn't be simpler:
PHP Code:
|
|
||||
|
Davidoff's solution is indeed simple, however it appears as though you're using a conventional modular file structure. If so, then once you have helpers in modules other than default Davidoff's solution will stop working for you.
You could set the helper path per request via an Action Helper and set it based on the requested module as so: PHP Code:
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth |
|
|||
|
Quote:
I will try the Davidoffs solution, I was hoping was something that would work by putting it in the bootstrap file once, seems like this should work. |
|
|||
|
Hi
Davidoff's solution didn't work, and for the plugin I have a question: why do you include the path instead of using addHelperPath() ? I tried including the path in the bootstrap file, but it didn't work. Also the path is: ../application/default/views/helpers And default it's just a folder that Zend Studio creates (don't know why). But this never changes. I don't know if you understood me well, I'm new to ZF so maybe some things I don't quite understood. Thanks for the help. |
|
|||
|
I took the line from your example.
But you probably need to pass the second parameter with the class name prefix. Sample code from my live, working app: PHP Code:
According to the API Docs, Docs For Class Zend_View_Abstract, the second argument defaults to Zend_View_Helper |
![]() |
| Thread Tools | |
| Display Modes | |
|
|