-- spaun <[EMAIL PROTECTED]> wrote
(on Wednesday, 07 November 2007, 10:37 PM -0800):
> IMHO, current implementation of view helpers is a bit odd. I see no point in
> current naming convention (why special method name instead of fixed
> interface?).
I have to agree with you at this point. However, there are good reasons
to keep it as-is for now:
* Backwards compatibility. Changing it now would break *many* apps.
* Compatability with other systems. Zend_View is based on Savant2 and
is a cousin to Solar_View. As such, helpers written for either of
those two classes will also work with Zend_View, and vice versa.
> Furthermore, I see no normal way to configure the helper pathes/prefixes. If
> I understand it right, I intended to put my helpers to
> application/view/helpers and give a class Zend_View_Helper prefix. Changing
> it breaks the idea.
You *can* do that already -- you simply have to setup your view object
and inject it into the ViewRenderer either in the bootstrap or an early
running plugin.
> I suppose it would be better to add and init script to helpers directory
> (something like __init__.php) and extend Zend_View to allow register helpers
> (something like registerHelper('helperName', callable $callback) and
> registerLazyHelper('helperName', $className, $methodName, $file = null)).
>
> The view object should handle setting the helper directory by including this
> init script thus providing self instance to it.
Interesting idea -- please create a proposal for it. :-)
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/