I was doing this way before, but always passing messages and errors to view,
and them asking to show both.... i don´t know, i think it should be more
framework responsibility, so i made a view helper that handle it all
automatically, i put error and messages in the controller, redirect, and the
view show alerts and errors if there are some. piece of cake.

If i do the way your said, pass the flashMessager to the view, it will have
more powers than my way, because in my way the flashMessage is encapsulated
in a view helper, and not in the view.

And thanks for contributing with more solutions.

::: Diego Potapczuk


On Tue, Jan 5, 2010 at 8:11 PM, Ralph Schindler <ralph.schind...@zend.com>wrote:

> That, or assign it from within a controller's action (which might be more
> appropriate:
>
> $this->view->flashMessenger = $this->_helper->FlashMessenger;
>
> But technically, you should probably simply pass the messages to the view
> without giving them full access to the object:
>
> if ($this->_helper->FlashMessenger->hasMessages()) {
>  $this->view->messages = $this->_helper->FlashMessenger->getMessages();
> }
>
> Cheers,
> Ralph
>
> Diego Potapczuk wrote:
>
>> Ok, i think i found it:
>>
>> $this->_flashMessenger =
>> Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger');
>>
>>
>>
>>
>> ::: Diego Potapczuk
>>
>>
>> On Tue, Jan 5, 2010 at 3:13 PM, Diego Potapczuk <potapc...@gmail.com<mailto:
>> potapc...@gmail.com>> wrote:
>>
>>    How can i get the FlashMessenger inside a View Helper? I already saw
>>    it somewhere how to get a controller_action_helper, but i can´t find.
>>
>>
>>
>>    ::: Diego Potapczuk
>>
>>
>>

Reply via email to