Zend FlashMessenger无法找到插件

时间:2011-10-14 16:09:16

标签: zend-framework

你好我们正在使用PHP 5.2.6-1和Zend 1.9,我试图使用这样的FlashMessenger插件:

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

但是我收到一条奇怪的错误消息:

消息:在注册表中找不到名称为“FlashMessenger”的插件;使用的路径:Zend_View_Helper_:Zend / View / Helper /:/ var / www / webtest.com / mycaseapp / views / helpers /

1 个答案:

答案 0 :(得分:0)

在你的动作控制器中你应该有

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

然后在您的视图脚本中,您将拥有类似

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

See the manual page here