user187809
user187809

Reputation:

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.

Upvotes: 0

Views: 772

Answers (1)

Phil
Phil

Reputation: 164826

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

Upvotes: 1

Related Questions