views:

539

answers:

2

Hi Stackland

I am rather new to ZendX and I really wanted to get the simple JQuery example on Zend to get working.I have followed the example on the link below but all I get is a plain textbox without any datepicker functionality as I expected.

http://stackoverflow.com/questions/1616857/best-way-to-start-using-jquery-in-a-zend-framework-1-9-application

In my bootstrap I have

protected function _initViewHelpers()
    {   

        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();     

        $view->doctype('XHTML1_STRICT');
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
        $view->headTitle()->setSeparator(' - ');
        $view->headTitle('JQUERY Test');

        //assuming you already have this function in your bootstrap
        //jQuery (using the ui-lightness theme)

        $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/js/jquery-1.3.2.min.js')
                        ->setUiLocalPath('/js/jquery/js/jquery-ui-1.7.2.custom.min.js');                                            
    }   

In my layout I have included

<head>
    <?php echo $this->HeadMeta(); ?>
    <?php echo $this->headTitle(); ?>
    <?php echo $this->headLink(); ?>
    <?php echo $this->headScript(); ?>
    <?php echo $this->jQuery(); ?>
    <?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/main.css'); ?>   
    <?php echo $this->render('_javascript.phtml'); ?>
</head>

What am I missing?

A: 
  1. Did you call the view helper from within your view script, with valid options? See example from your refered question

  2. Did you double check the paths to your local js- & css-files?

chelmertz
That is the solution I used to do my example but to no avail.Sorry I forgot to specific that link earlier.As for the local files I have cross checked and the paths and they are correct.
davykiash
A: 

You add ZendX_JQuery::enableView($view); to _initViewHelpers

scopus