0

我有一个用 Zend Framework 封装编写的应用程序,我想通过添加以下代码在我的默认模块中添加一个视图助手:

应用程序/模块/默认/视图/helpers/slideshow.php:

class Default_View_Helper_Slideshow extends Zend_View_Helper_Abstract

{

    public function slideshow()
    {

    }

}

应用程序/Bootstrap.php:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    public function _initViewHelperPath() {
        
        $this->bootstrap('view');
        $view = $this->getResource('view');

          $view->addHelperPath(
                APPLICATION_PATH . '/modules/default/views/helpers/',
                'Default_View_Helper');
 }

应用程序/模块/默认/视图/脚本/index/index.phtml:

<?php $this->slideshow(); ?>

并收到此错误:

信息:

在注册表中找不到名为“幻灯片”的插件;使用的路径: Default_View_Helper_: /var/www/go/application/modules/default/views/helpers/ Zend_View_Helper_: Zend/View/Helper/:/var/www/go/application/modules/default/views/helpers/

我应该怎么做才能解决它?

4

1 回答 1

1

您的助手的文件名应该是application/modules/default/views/helpers/Slideshow.php(注意大写“S”)。

于 2013-01-03T11:22:02.927 回答