Zend FlashMessenger cant find Plugin

2019-07-23 16:22发布

Hello guys I am using PHP 5.2.6-1 and Zend 1.9, I am trying to use the FlashMessenger plugin like this:

$flashMessenger = $this->_helper->getHelper('FlashMessenger');
$flashMessenger->addMessage('We did something in the last request');    

but I get a weird error message:

Message: Plugin by name 'FlashMessenger' was not found in the registry; used paths: Zend_View_Helper_: Zend/View/Helper/:/var/www/webtest.com/mycaseapp/views/helpers/

1条回答
ゆ 、 Hurt°
2楼-- · 2019-07-23 16:55

In your action controller you should have

$flashMessenger = $this->_helper->getHelper('FlashMessenger');
$flashMessenger->addMessage('We did something in the last request');
$this->view->messages = $flashMessenger->getMessages();

Then in your view script you would have something like

<?php
foreach($this->messages()as $message){
    echo $message . "<br/>";
}

See the manual page here

查看更多
登录 后发表回答