I'm wondering what peoples thoughts are on automatically registering
view variables and/or using some other method to bridge the gap
between Action Helper objects and a View object.
With the introduction of the ViewRenderer helper, I starting to more
and more see the value of Action Helpers. But there are a lot of
scenarios where I'd like to inject the functionality into the Action
without having to somehow route the output of such functionality into
the View.
Take for instance the FlashMessenger helper; if I wanted to
automatically collect messages and send them to the View object I'd
have to probably subclass Zend_Controller_Action and override the
render() function with a method which registers the messages in the
view. However this wont work with ViewRenderer!
One other option I considered would be somehow incorporating this
automatic View Variable assigning into the postDispatch method.
However is there any specified order in which postDispatch will run
for registered Action Helpers?
Another option again would be to write a View Helper class which
would somehow interface with the Action Helper and provide view
access for the output of the Action Helper.
None of these options seems particularly elegant or suitable to me.
Can anyone suggest a best-practise for automatically registering view
variables in this fashion? Is there a better way to access these
variables that perhaps I'm not considering?
Thanks,
--
Mathew Byrne