2010年8月9日星期一

[fw-mvc] Re: View Helper classes - best solution for this scenario?

Rishi Daryanani wrote:
>
> I was wondering if a "helper" is the right thing for me here
>
A custom view helper should get you what you want in this case.

Start here:

Writing Custom Helpers
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.custom

In order to access your view helper, you'll need to register it. You can do
this by:

1 - Use application.ini with the view resource
resources.view.helperPath.My_Namespace_Prefix =
"path/to/my/namespace/prefix"

or

2 - Register the helper path via the Bootstrap:
$view->addHelperPath(...);

or

3 - $view->registerHelper(new classNameOfHelper(), 'nameOfHelper');


Those are in order of preference (#3 being the least preferable). #1 and #2
benefit from lazy loading.

-----
--
Wil Moore III

Why is Bottom-posting better than Top-posting:
http://www.caliburn.nl/topposting.html
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/View-Helper-classes-best-solution-for-this-scenario-tp2317663p2319132.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: