Pages

Sunday, August 24, 2014

Zend-Using ZendX library in Zend

Recently I had to use Jquery UI components in one of my applications.I used ZendX Library to counter the same and I worked upon the same as the same as follows

 In bootstrap.php

       protected function _initJquery() {  
     $view = Zend_Layout::startMvc()->getView();  
     $view->addHelperPath("ZendX/JQuery/View/Helper",  
                 "ZendX_JQuery_View_Helper"  
                );  
     Zend_Controller_Action_HelperBroker::addHelper(  
               new ZendX_JQuery_Controller_Action_Helper_AutoComplete()  
                );  
     $view->jQuery()  
        ->enable()  
        ->setVersion('1.11.0')  
        ->setUiVersion('1.10.4')  
        ->addStylesheet('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css')  
        ->uiEnable();  
   }  

In View

 <?php  
 $this->jQuery()->addJavascriptFile($this->baseUrl().'/assets/js/validation/jquery.validate.min.js');  
 $this->headScript()->prependFile($this->baseUrl().'/assets/js/validation/myvalidation.js');  
 ?>  

Layout

 <?php   
 echo $this->jQuery();  
 echo $this->jQuery()->uiEnable();  
 echo $this->headScript();  
 echo $this->headLink();  
 echo $this->headTitle('My Website');  
 ?>  

No comments:

Post a Comment