I have touched on this in the past.. I think the only reason I have not put together a component proposal is that it requires finalization of a few things..

This component, when done right, would be a helper to Zend_Controller_Action and a helper of Zend_View (>_Helper) and would consume Zend_Session.

I think we are getting real close to finializing zend_session as you can see in aother thread, we are simply at a point where the community is weighing in on the public facing API.

I imagine after 1.0 of the ZendFramework you will be able to see more 'decorator' type components that either tie in or consume multiple components in the framework..

In the meantime, you can use my static- standalone class as its what I use everyday:

http://svn.ralphschindler.com/repo/ZendFramework/library/

It currently uses Zend_Session, also implementing countable, iteratable interface. I use it to add messages in my controllers, and also to retrieve messages in my view scripts.

FlashMessage::add($message);

if (FlashMessage::hasMessages()) {
    $messages = FlashMessage::getMessages();
    foreach ($messages as $message) { echo $message; }
}

It also supports namespacing so that multiple components can use FlashMessage and keep their messages separated, this is good if you know certain (named) messages will have to be directed to a specific part of the view.

cheers,
ralph



Andrew Yager wrote:

On 28/01/2007, at 9:26 PM, Ralf Eggert wrote:

[snip]

Hope this helps and if someone thinks I forgot anything please add your
comments...

The only other comment that I'd make is it appears that the flash stuff does a bit of Session magic - essentially it's storing a message in a session, and clearing it at the end of the next action.

This behavior should be easy to duplicate by registering a session object (perhaps in the 'flash' namespace?) and at the end of every action (perhaps by overriding the default action controller) clearing out the namespace of all variables that were there at the start... or something like that... (you'd need to be a bit smart about it and make sure you didn't clear notifications that had changed for instance...)

Andrew

_________________________
Andrew Yager, Managing Director
Real World Technology Solutions
ph: 1300 798 718 or (02) 9563 4840
fax: (02) 9563 4848 mob: 0405 152 568
http://www.rwts.com.au/
_________________________




Reply via email to