Group all flash messages at end of request
1 2 3 4 56 7 8 9 1011 12 13 14 15 | class Helper_FlashMessages extends Zend_Controller_Action_Helper_Abstract { public function postDispatch() { // get current controller $fm = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger'); $this->_actionController->view->flashMessages = implode('<br>', $fm->getMessages()); } } How to use (I use in bootstrap): $fm = new Helper_FlashMessages(); Zend_Controller_Action_HelperBroker::addHelper($fm); |
Comments
You must login before commenting on a snippet. If you do not have an account, please register.
Snippet description
Sometimes its easier to just grab all the flash messages like this to use in your layout. You could probably use placeholders instead, just modify as you see fit.
Snippet details
- Created:
-
Kenrick
- Edited:
-
Kenrick
- Revision Id:
- 15
- Edit Message:
- Initial Release
- Tags:
- action helper flash messages
- Comments:
- 1
- Views:
- 102
- Points:
- 0 (0 votes)
1 year ago
Perhaps you should just make it configurable (through __construct( array $options )).
Good idea, i didn't thought about it before.