Zend framework Can';在Zend_框架中注册JQuery插件

Zend framework Can';在Zend_框架中注册JQuery插件,zend-framework,Zend Framework,我似乎无法让ZendX_JQuery工作。助手路径不会加载,因此插件没有注册。我已经全部尝试过了,在引导文件中添加,在配置中添加,等等。 引导: protected function _initJqueryLoad() { $view = new Zend_View(); $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper'); $viewRenderer = n

我似乎无法让ZendX_JQuery工作。助手路径不会加载,因此插件没有注册。我已经全部尝试过了,在引导文件中添加,在配置中添加,等等。 引导:

    protected function _initJqueryLoad()
    {

      $view = new Zend_View();
$view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
//return $view;
    }
我的配置:

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

phpSettings.date.timezone = "GMT+2"
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
autoloaderNamespaces[] = "JP_"
autoloaderNamespaces[] = "ZendX_"


resources.view.helperPath.JP_View_Helper = "JP/View/Helper"
resources.view.helperPath.ZendX_JQuery_View_Helper = "ZendX/JQuery/View/Helper"
autoloaderNamespaces[] = "Sozfo_"


resources.session.save_path = APPLICATION_PATH "/data/sessions"
resources.session.gc_maxlifetime = 18000
resources.session.remember_me_seconds = 18000

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules = ""
错误消息:

Message: Plugin by name 'JQuery' was not found in the registry; used paths: JP_View_Helper_: JP/View/Helper/ JP_Controller_Helper_: JP/Controller/Helper/ Sozfo_View_Helper_: Sozfo/View/Helper/ : C:\Zend\Apache2\htdocs\LTSSP\application/helpers/ Zend_View_Helper_: Zend/View/Helper/
Stack trace:

#0 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\View\Abstract.php(1174): Zend_Loader_PluginLoader->load('JQuery')
#1 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\View\Abstract.php(610): Zend_View_Abstract->_getPlugin('helper', 'jQuery')
#2 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\View\Abstract.php(336): Zend_View_Abstract->getHelper('jQuery')
#3 C:\Zend\Apache2\htdocs\LTSSP\application\layouts\baklans.phtml(23): Zend_View_Abstract->__call('jQuery', Array)
#4 C:\Zend\Apache2\htdocs\LTSSP\application\layouts\baklans.phtml(23): Zend_View->jQuery()
#5 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\View.php(108): include('C:\Zend\Apache2...')
#6 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\View\Abstract.php(880): Zend_View->_run('C:\Zend\Apache2...')
#7 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\Layout.php(796): Zend_View_Abstract->render('baklans.phtml')
#8 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\Layout\Controller\Plugin\Layout.php(143): Zend_Layout->render()
#9 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\Controller\Plugin\Broker.php(331): Zend_Layout_Controller_Plugin_Layout->postDispatch(Object(Zend_Controller_Request_Http))
#10 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\Controller\Front.php(965): Zend_Controller_Plugin_Broker->postDispatch(Object(Zend_Controller_Request_Http))
#11 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#12 C:\Zend\Apache2\htdocs\LTSSP\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#13 C:\Zend\Apache2\htdocs\LTSSP\public\index.php(51): Zend_Application->run()

假设您的ZendX位于库forlder中,我认为您可以在Bootstrap.php中注册JQuery视图助手,如下所示:

protected function _initJsqueryLoad() {
    $this->bootstrap('view');
    $view = $this->getResource('view');
    $view->addHelperPath(APPLICATION_PATH . '/../library/ZendX/JQuery/View/Helper',     'ZendX_JQuery_View_Helper');
}
你的配置中的东西那时就不需要了。希望它对你有用

使用的路径:JP_View\u Helper\uu:JP/View/Helper/JP_Controller\u Helper\ujp/Controller/Helper/Sozfo\u View\u Helper\uzfo/View/Helper/:C:\Zend\Apache2\htdocs\LTSSP\application/helpers/Zend\u View\u Helper\uzend/View/Helper/

基于此,您可能会看到ZendX目录未被扫描

  • 向助手代理注册路径
  • 将路径添加到autoloader(例如,从Zend framework源存档复制文件,或将路径添加到
    ZendX
    包含路径
  • 应用程序.ini中

    resources.view.helperPath.ZendX_JQuery_View_Helper = "ZendX/JQuery/View/Helper"
    
    index.php
    中:

    set_include_path(implode(PATH_SEPARATOR, array(
        '/home/user/www/library/ZendFramework/1.11.2/library', // Zend dir is here
        '/home/user/www/library/ZendFramework/1.11.2/extras/library', // ZendX dir is here
        '/home/user/www/library/misc',
        get_include_path(),
    )));
    
    鉴于:

    $this->jQuery()->enable();
    

    对我来说,解决这个问题的方法是将助手路径放在
    而不是


    有点小毛病。应该将此作为bug发布。

    @Janis Peisenieks。你有没有尝试过在你的application.ini.Yup中不包含所有关于ZendX、JQuery的内容,但我刚刚找到了答案。刚刚发布。在以前的代码中,您创建了新的
    ViewRenderer
    ,另一个实例是
    View
    。这与双引号或单引号无关。是的,确实如此,但即使没有其他ViewRenderer,它也无法工作。
       protected function _initJqueryLoad()
    {
    
        $view = new Zend_View();
    
      $view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
      $view->jQuery()->addStylesheet('/js/jquery/css/ui-lightness/jquery-ui-1.7.2.custom.css')
        ->setLocalPath('/js/jquery/jquery.php')
        ->setUiLocalPath('/js/jquery-ui-1.7.3.custom.min.js');
        $view->jQuery()->enable();
    ZendX_JQuery::enableView($view);
    return $view;
    }