AH, pardon the self-reply, but I realized it is because I have the plugin
firing at routeStartup(); I shifted to postDispatch(), and voila. The view
is now accessible.
Thanks for all your speedy replies. they were very helpful.
jlevy wrote:
>
> Odd, that my view is 'null'.
>
> $view =
> Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view;
>
> $view->assign('foo', 'bar');
>
> yields a null view object.
>
>
>
> Andries Seutens wrote:
>>
>> jlevy schreef:
>>> I'd like to set a var, or series of vars and make available to my view
>>> from a
>>> plugin.
>>>
>>> In a project I'd done w/ZF .8, I had the view set in my registry, and it
>>> was
>>> as simply matter of fetching the view out of the reg and setting a
>>> var/vars.
>>> The view script would then see the vars easily.
>>>
>>> In a new project I'm working on, I've avoided the use of the registry,
>>> and
>>> am having difficulty determining where the view object is, how to get
>>> it,
>>> and consequently, how to set some vars into it.
>>>
>>> Does the view object even exist yet (my plugin fires at routeStartup)?
>>>
>>> Is the view available from a plugin?
>>>
>>> Thanks, and I appreciate the help. I'm struggling just a bit trying to
>>> adapt
>>> to RC2, so forgive any ridiculous questions or assumptions I might make.
>>
>> Hi,
>>
>> You could do:
>>
>> $view =
>> Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view;
>>
>> $view->assign('foo', 'bar');
>>
>> Best,
>>
>> Andries Seutens
>> http://andries.systray.be
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Accessing-View-from-a-Plugin--tf3928197s16154.html#a11143573
Sent from the Zend Framework mailing list archive at Nabble.com.