Zend Framework - Flashmessenger - Only one character

允我心安 提交于 2019-12-10 19:14:03

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/8518655/zend-framework-flashmessenger-only-one-character

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!