Php Zend_视图和addHelperPath

Php Zend_视图和addHelperPath,php,zend-framework,helper,Php,Zend Framework,Helper,我在使用空的Zend_视图和addHelperPath时遇到问题。 有人知道两者的区别在哪里 $view = Zend_Layout::getMvcInstance()->getView(); $view->addHelperPath( APPLICATION_PATH . '/views/helpers/layouts', 'FOO_View_Helper' ); 及 在第一个示例中,我的视图助手被加载。第二个例子说 Plugin by name 'PriceOu

我在使用空的Zend_视图和addHelperPath时遇到问题。 有人知道两者的区别在哪里

$view = Zend_Layout::getMvcInstance()->getView();
$view->addHelperPath(
    APPLICATION_PATH . '/views/helpers/layouts', 
   'FOO_View_Helper'
);

在第一个示例中,我的视图助手被加载。第二个例子说

Plugin by name 'PriceOutput' was not found in the registry; used paths:
    Zend_View_Helper_: Zend/View/Helper/;./views\helpers/
我添加了一个

echo "<xmp>", var_dump($registry), "</xmp>";
帮助路径都在同一个地方。但在第二个例子中,ZF似乎只在
Zend_View_Helper
中搜索,而不在
FOO_View_Helper
中搜索

有什么想法吗

正如我所说的,第一个例子看了FOO_View_Helper,第二个不是:
注册表中未找到未捕获的异常“Zend_Loader_PluginLoader_exception”,消息为“Plugin by name'FooBar”;使用的路径:FOO\u View\u Helper\uc:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/basket/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/globallayer/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/globallayer/help/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/globallayer/styleinfolayer/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/layout/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/nys/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/overview/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/search/;C:\program\Zend\Apache2\htdocs\trunk\u webshop\application/views/helpers/singleproductview/;第414行的C:\Program\Zend\Apache2\htdocs\trunk\u core\u webshop\library\Zend\Loader\PluginLoader.php中的C:\Program\Zend

($view->getHelperPath()应该更好:p)

$view = Zend_Layout::getMvcInstance()->getView();
$view->addHelperPath(
    APPLICATION_PATH . '/views/helpers/layouts', 
   'FOO_View_Helper'
);
您正在获取现有视图并设置路径,这是正确的


但是在第二个示例中,您创建了一个新视图,然后设置了路径,从而替换了引导程序自动(正确)加载的现有视图。此新视图不知道您的引导,因此也不知道您的自动加载器-因此会出现错误。

尝试在视图脚本中调用不存在的帮助程序,错误输出会告诉您它试图访问哪些帮助程序路径。知道我要手动设置哪些配置吗?getView()使用预先配置的视图实例检索ViewRenderer::initView()。我试图尽可能好地“复制”对象结构,尤其是print_r()说它们应该是相同的对象。(当然不是,但所有转储和对象结构都是相同的)。该视图是在我的引导类的_initView()中设置的
PluginLoader::load($name, $throwExceptions = true)
$view = Zend_Layout::getMvcInstance()->getView();
$view->addHelperPath(
    APPLICATION_PATH . '/views/helpers/layouts', 
   'FOO_View_Helper'
);