Is there any requirement about the name of the helper? Because it does not
work for me. I have to put the helper class into the path
/module_name/views/helpers

Does it need to be declared like:

class Zend_View_Helper_[module_name]_[helper_name] {} ???

I've tried several ways and it only works putting the helper classes in each
module. A global helper located in /application/views/helpers does not work.

Thanks.




SiCo007 wrote:
> 
> Yes it is, simply use the method as posted above:
> 
> $this->view->addHelperPath($defDir);
> 
> Then make $defDir the path to the directory holding your helpers. Or you
> can do it in the bootstrap.
> 
> Simon
> 
> 
> Mauricio Cuenca wrote:
>> 
>> Hellow Matthew,
>> 
>> Is it possible to have a common directory of helpers for the whole
>> application, not specific ones for each module???
>> 
>> My application got bigger and I moved some controller to its own module
>> and now the usual path (application/views/helpers) is not recognized.
>> 
>> 
>> 
>> Matthew Weier O'Phinney-3 wrote:
>>> 
>>> -- ashish.sharma <[EMAIL PROTECTED]> wrote
>>> (on Monday, 10 December 2007, 03:34 AM -0800):
>>>> i have a query regarding helpers,i have helpers in my default module
>>>> helpers
>>>> folder i:e(in application/views/helpers/generateKey.php) now i have
>>>> created
>>>> new module and i want to use that helper in this module.how can i do
>>>> this
>>>> ,plz help me as its very urgent.
>>> 
>>> Short answer:
>>> 
>>>     // within your action controller:
>>>     $conDirs =
>>> Zend_Controller_Front::getInstance()->getControllerDirectory();
>>>     $defDir  = dirname($conDirs['default']) . '/views/helpers';
>>>     $this->view->addHelperPath($defDir);
>>> 
>>> Long answer:
>>> 
>>> You grab the controller directory associated with the module you wish to
>>> use, determine the views directory associated with it, and add its
>>> helpers subdirectory as a helper path on the view object.
>>> 
>>> -- 
>>> Matthew Weier O'Phinney
>>> PHP Developer            | [EMAIL PROTECTED]
>>> Zend - The PHP Company   | http://www.zend.com/
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/use-helpers-in-modules-tp14251261s16154p15547020.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to