How do I access flashmessenger in my layout file, in zend framework?

半城伤御伤魂 提交于 2019-12-12 04:39:35

问题


I want to display my flash messages in my application's layout file - not sure how to access it though. I set the value in my action.


回答1:


Try my view helper - https://github.com/philBrown/Tolerable/blob/master/library/Tolerable/View/Helper/FlashMessenger.php

This even includes translations if you have them configured.

To display messages from the default namespace, simply use

<?php echo $this->flashMessenger() ?>

To set a namespace, provide it as the first argument

<?php echo $this->flashMessenger('errors') ?>

The default is to render each message in an unordered list however you can change that by providing a view partial

<?php echo $this->flashMessenger(null, 'flash-messages-partial.phtml') ?>


来源:https://stackoverflow.com/questions/7285131/how-do-i-access-flashmessenger-in-my-layout-file-in-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!