Search code examples
zend-frameworkflash-message

Zend Framework - Flashmessenger - Only one character


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?


Solution

  • 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>