3

I have a little problem with FlashMessenger. When I want to retrieve the messages in my layout, it writes the first letter of the message... example "test" displays "t".

I tried a solution posted in this question, but nothing changed for me.

I use php 5.3.6

Here is my code:

  • In my method :

    $message = 'test';
    $this->_helper->FlashMessenger($message);
    
  • Call in the Layout

    <div id="message_box">
        <?php echo $this->flashMessages(); ?>
    </div>
    

Can someone help me?

Community
  • 1
  • 1
Raphaël
  • 1,141
  • 3
  • 18
  • 32
  • Duplicate of http://stackoverflow.com/questions/7770434/zend-flashmessenger-cant-find-plugin/7774996#7774996? Anyway, my answer to that will solve your problem. – vascowhite Dec 16 '11 at 03:26
  • It's not the same problem, I've not an error like you, but thank you =) – Raphaël Dec 20 '11 at 13:56

1 Answers1

6

Try this:

In controller:

$this->_helper->FlashMessenger->addMessage("Your message", 'actions');

// you can redirect to another controller ...


$this->view->messages = $this->_helper->FlashMessenger->getMessages('actions');

In phtml file:

 <!-- some html code -->

<div id="message_box">
     <?php echo $this->messages[0]; ?>
</div>
tasmaniski
  • 4,767
  • 3
  • 33
  • 65
  • How the flash messages can be accessed in view instead of controller? I do not want to use this "$this->view->messages = $this->_helper->FlashMessenger->getMessages('actions');" in controller. – Faiyaz Alam Feb 12 '16 at 13:18