I am trying to test if jQuery is working in my application I have the following in my bootstrap:
bootstrap:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initView()
{
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
$view->headTitle()->setSeparator(' - ');
$view->headTitle('IMR - BI System');
$view->env = APPLICATION_ENV;
$view->baseUrl = Zend_Registry::get('config')->root_path;
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
$view->jQuery()->addStylesheet($view->baseUrl . '/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css');
$view->jQuery()->setLocalPath($view->baseUrl . '/js/jquery/js/jquery-1.7.2.min.js');
$view->jQuery()->setUiLocalPath($view->baseUrl .'/js/jquery/js/jquery-ui-1.8.20.custom.min.js');
$view->jQuery()->enable();
$view->jQuery()->uiEnable();
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
return $view;
}
}
and then this in my view:
<?php echo $this->datePicker("dp1", '', array('defaultDate' => date('Y/m/d', time()))); ?>
and I get the text box but with the following error -> http://pastebin.com/7Hv7d2Qf
also in the bootstrap file I had to take the following line out:
$view->baseUrl = Zend_Registry::get('config')->root_path;
otherwise i got this error -> http://pastebin.com/tde4J7L1
Thanks
Add this method above your _initView method
And in your application.ini add this line
If you are using layout then do this in your layout.phtml otherwise paste it above your datepicker