简体   繁体   中英

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

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.

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') ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM