-- Nogyara <[EMAIL PROTECTED]> wrote
(on Monday, 26 November 2007, 01:27 PM -0800):
> just a quick question, how can someone set parameters for view helper's
> constructor?
>
> It seems, it is possible, according to this post
> (http://www.nabble.com/Set-View-Helper-Options-%28formTextarea%29-tf4475302s16154.html#a12760567)
> but I can't figure out how, when view helper's main method is called
> directly from view script, without any constructing of helper itself.
> Any clues, pls?
You can't. Zend_View does not pass any parameters to individual view
helpers. Typically, if you need to configure a view helper before using
it, the best way includes:
* Adding accessors to your view helper so that you can configure it
* Grabbing an instance of the view helper from the view object prior
to using it in a view script:
$foo = $view->getHelper('foo');
$foo->setSomething($bar)
->setOtherThings($baz);
Since the view object uses the same instance of a helper every time it
is requested, an approach like this will allow you to set default state
for it in all invocations.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/