Tuesday, May 15, 2012

Zend Notification

Zend built in notification are divided into session saved message, and current message.
$flashmsg = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');

To get last added message in previous request (which is saved in the session):
$flashmsg->hasMessages();
$aMsg = $flashmsg->getMessages();

To clear the messages storage:
$flashmsg->clearMessages();
--------------------
To get current added message (same request):

$flashmsg->hasCurrentMessages();
$aMsg = $flashmsg->getCurrentMessages();

To clear the current messages storage:
$flashmsg->clearCurrentMessages();


Please note that the current and the session message are separated, and need to be called respectively to retrieve all messages in the notification

No comments: