Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 461
Raphaël Avatar asked Feb 18 '26 05:02

Raphaël


1 Answers

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>
like image 168
tasmaniski Avatar answered Feb 21 '26 15:02

tasmaniski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!