Zendcasts Forum

A community of developers who work with the Zend Framework and other enterprise PHP technologies

You are not logged in.

#1 2010-07-16 08:54:40

mihat
New member
From: Slovenia
Registered: 2010-07-05
Posts: 2
Website

ZendX_Jquery setup

Hi!

I'm trying to setup a jquery view helper. Code is as follows:

Bootstrap.php

protected function _initLayoutt(){
        $config = &$this->registry->config->resources->view;

        $view = new Zend_View();

        $view->strictVars($config->strictVars);
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset='.$view->getEncoding());
        $view->headTitle($config->headtitle);
        $view->headTitle()->setSeparator($config->headseperator);

        //JQuery support
        $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);
        
        $view->JQuery() ->addStylesheet('/css/custom-theme/jquery-ui.custom.css')
                        ->setLocalPath('/js/jquery.min.js')
                        ->setUiLocalPath('/js/jquery-ui.custom.min.js')
                        ->enable()
                        ->uiEnable();

        return $view;
    }

I cannot access jquery() method from the view scripts, controllers or layout scripts. I get error msg:

Zend_Loader_PluginLoader_Exception: Plugin by name 'JQuery' was not found in the registry


ZendX namespace is in include path.


Can someone please point me in  the right dorection ... Thanks!

Offline

#2 2010-07-17 22:22:28

Jon Lebensold
Administrator
Registered: 2009-06-27
Posts: 279

Re: ZendX_Jquery setup

hi Mihat,

I'm posting a video on zendx_jquery today!

Offline

#3 2010-07-18 19:24:50

mihat
New member
From: Slovenia
Registered: 2010-07-05
Posts: 2
Website

Re: ZendX_Jquery setup

Hi!

Thanks for your vid! I prefer jquery helpers to be set up in bootstrap since I use them a lot.

I found the error in my code with a help on zend forum.

I didn't use _initView() function so the view object was not fully set up.

Is there a list of init functions we can use? I thought that init function names are optional as long as there is "_init" prefix?

Offline

#4 2010-11-05 10:47:06

Sergey Romanov
New member
Registered: 2010-11-04
Posts: 2

Re: ZendX_Jquery setup

Please post your final working code. I also need this.

Offline

Board footer

Powered by FluxBB