Zend视图,找不到插件

时间:2012-10-24 12:14:28

标签: zend-framework zend-view

我正在使用zend视图类创建电子邮件模板,并分配变量.. 我也在使用视图脚本文件的帮助程序,但渲染时出现错误:

Message: Plugin by name 'EmTpl' was not found in the registry; used paths: Zend_View_Helper_: Zend/View/Helper/:/application/modules/customers/views/helpers/

然而,当我使用on dispatch时,这个插件就存在了,就像加载带有视图脚本的控制器一样,该脚本加载了名为'EmTpl'的帮助器。

这是我的电子邮件脚本:

    $html = new \Zend_View();
    $html->setScriptPath(APPLICATION_PATH . '/modules/admin/views/scripts/emails/');
    //$html->addHelperPath('Zend/View/Helper/','Zend_View_Helper_');
    $html->addHelperPath(
            APPLICATION_PATH . '/modules/customers/views/helpers/','Zend_View_Helper_'
    );


    $html->render("customer-new.phtml");

并在我的customer-new.phtml中,

那里有:

<body>
hello, <?=$this->name?>
<?=$this->emTpl?>
</body>

这个插件在控制器视图脚本中调用时工作正常... 但我希望它能与我的电子邮件模板脚本一起使用。

感谢

1 个答案:

答案 0 :(得分:0)

在设置脚本路径之前必须添加辅助路径...