How to add a view helper directory (zend framework)?

It can be done very easily with the built in Zend_Application resource for the view. If you're using ini configs, add a line like this.

It can be done very easily with the built in Zend_Application resource for the view. If you're using ini configs, add a line like this: resources.view.helperPath. My_View_Helper = "My/View/Helper" The end of the key is the class name prefix, and the value the path where they reside.

Helper paths are added through Zend_View_Abstract::addHelperPath(). You can call this method directly on an existing View instance. Helper paths can also be configured in various ways during bootstrap.

Check out the ZF manual chapter on Zend_Application to see how to use Bootstrap classes and resources: http://framework.zend.com/manual/en/zend.view.helpers.html http://framework.zend.com/manual/en/zend.application.quick-start.html http://framework.zend.com/manual/en/zend.application.examples.html http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.view.

1 Although all these options are correct, and will work, I feel the application. Ini solution suggested by David to be the "best-practice". Also, in your "_initView()" you could use $this->bootstrap('view'); $view = $this->getResource('view'); to use the application.

Ini view instead of one you randomly create... – gnarf Feb 25 '10 at 22:22 @gnarf with the exception of addHelperPath(), the bootstrap example is copied 1:1 from the ZF reference guide. It shouldn't be taken as anything else but an example. I am well aware there is different ways to do it (e.g. Using an Ini).

Feel free to do it differently. – Gordon Feb 25 '10 at 22:41 this links are not helpfull - zf documentation is pure in general and particular for helpers didn't contains real examples – se_pavel May 18 '10 at 12:35 @se_pavel they are not helpful if you want to copy and paste without wanting to understand how things work.In this case I prefer to not give a fish, but give hints how to learn how to fish. – Gordon Nov 28 '10 at 13:42 OTOH, sometimes working examples make sense because they work.

;) – sims Mar 4 '11 at 16:17.

I have written short simple tutorial for registering the zend view helpers from a common directory, which can be accessed throughout the application. Please have a look. mixedwaves.com/2010/03/accessing-and-usi....

EDIT: Check out view helper in zend framework for a more detailed take on this issue using rob allen's Loggedinas view helper. Not only can you do as specified by David Caunt, but you can also do it like this in your bootstrap. Note there is always more than one way to do anything in Zend Framework Check out devzone.zend.com/article/3412 If you have access to the view object, do the following.

AddHelperPath('My/View/Helper/', 'My_View_Helper');? > you may need to obtain the view object if you in a front controller plugin Also Check out this really great set of posts starting here: http://zend-framework-community.634137.n4.nabble.com/Getting-view-from-Bootstrap-ZF1-8-tp659447p659460.html.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions