سؤال

I have a zend framework project and use the ZendX_JQuery_View_Helper in my bootstrap to facilitate setting up my jquery and jqueryUI.

I have searched the internet, and it seems that this component will automatically load these components from the google CDN if available, and from my local copy if not.

Is this really true? I haven't even told it where the google CDN is. Also, if I mess up my local path to jquery, jquery no longer works. Since I am connected to the internet, I would have expected it to fetch straight from google CDN and not notice my incorrect local path.

So, my question is:

Does ZendX_JQuery_View_Helper automatically aquire these components from google CDN, and if not how can I achieve this?

protected function _initViewHelpers() {

        $view = $this->getResource('View');
        //look at what the below means
        $view->doctype('XHTML1_STRICT');
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
        $view->headTitle()->setSeparator(' - ');
        $view->headTitle('wwwwwww');

        $view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
        $view->jQuery()->addStylesheet('/js/jquery/css/ui-lightness/jquery-ui-1.8.17.custom.css')
                ->setLocalPath('/js/jquery/js/jquery-1.7.1.min.js')
                ->setUiLocalPath('/js/jquery/js/jquery-ui-1.8.17.custom.min.js');

    }
هل كانت مفيدة؟

المحلول

By default it will use the CDN, but providing the local path via the setLocalPath method will force the view helper to use local copy instead. So if you wish to use google then you don't have to specify any location at all, but you might want to specify which version you require.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top