I do not call setUseProgrammatic() at any point.

I followed your advice and moved the create view and Dojo initialization
code into my index.php:

    // Set up the front controller
    $front = Zend_Controller_Front::getInstance();
    $front->registerPlugin(new LoggerPlugin());
    $front->throwExceptions(false);
    $front->setControllerDirectory(GOGOVERDE_PATH_ROOT .
'/application/controllers');
    $front->setBaseUrl($config->www->baseurl);
    
    // Create the view
    $view = new Zend_View; 
    Zend_Dojo::enableView($view); 
    $view->dojo()->setLocalPath($front->getBaseUrl()  .
'/js/dojo/dojo/dojo.js')
                 ->addStyleSheetModule('dijit.themes.tundra')
                 ->disable();

this is now throwing the following exception:

Message: Plugin by name Dojo was not found in the registry. Stack trace: #0
/Library/WebServer/ZendFramework-1.6.0RC3/library/Zend/View/Abstract.php(1114):
Zend_Loader_PluginLoader->load('Dojo')
#1 /Library/WebServer/ZendFramework-1.6.0RC3/library/Zend/Vie

earlier in my bootstrap I register the autoloader:

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

so that I do not have to specify individual require once statements.

Thanks,
Peter


    // Create the view
    $view = new Zend_View; 
    Zend_Dojo::enableView($view); 
   
$view->dojo()->setLocalPath(Zend_Controller_Front::getInstance()->getBaseUrl() 
. '/js/dojo/dojo/dojo.js')
                 ->addStyleSheetModule('dijit.themes.tundra')
                 ->disable();

    // Set up the front controller and dispatch
    $front = Zend_Controller_Front::getInstance();




Matthew Weier O'Phinney-3 wrote:
> 
> -- Peter Wansch <[EMAIL PROTECTED]> wrote
> (on Tuesday, 02 September 2008, 09:41 PM -0700):
>> I am planning to use Dijit widgets such as dateTextBox in my ZF
>> application
>> to benefit from client-side validating widgets. I don't want to use
>> Zend_Form but mostly stay with HTML and Dijit-specific view helpers. Here
>> is
>> what I tried:
>> 
>> First, in my controller action method, I set the helper path and enable
>> Dojo
>> after initView:
>>     $this->initView();
> 
> First, unless you've disabled the ViewRenderer, you do not need to call
> initView() in your actions.
> 
>>     $this->view->addHelperPath('Zend/Dojo/View/Helper',
>> 'Zend_Dojo_View_Helper'); 
> 
> There's an easier way to do the above:
> 
>     Zend_Dojo::enableView($this->view);
> 
>>     $this->view->dojo()->enable(); 
>> 
>> Second, in my layout script (html_header.phtml) I add the code to load
>> Dojo:
>> 
>> <?= $this->doctype('XHTML1_TRANSITIONAL') ?>
>> <html xmlns="http://www.w3.org/1999/xhtml";>
>> <head>
>>     <?= $this->headTitle($this->page_title) ?> 
>>     <?php $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html;
>> charset=UTF-8'); echo $this->headMeta(); ?> 
>>     <?php
>> $this->headLink()->appendStylesheet(Zend_Controller_Front::getInstance()->getBaseUrl()
>> . '/css/common.css'); echo $this->headLink(); ?> 
>>     <?= $this->headStyle() ?> 
>>     <?php if ($this->dojo()->isEnabled()):
>>        
>> $this->dojo()->setLocalPath(Zend_Controller_Front::getInstance()->getBaseUrl()
>> .'/js/dojo/dojo/dojo.js')
>>                      ->addStyleSheetModule('dijit.themes.tundra');
> 
> I would recommend the following: in your bootstrap, do this:
> 
>     $view = new Zend_View;
>     Zend_Dojo::enableView($view);
>     $view->dojo()->setLocalPath($front->getBaseUrl() .
> '/js/dojo/dojo/dojo.js')
>                  ->addStyleSheetModule('dijit.themes.tundra')
>                  ->disable();
> 
> Then, in your layout, all you need to do is:
> 
>     <?= $this->dojo() ?>
> 
> This simplifies your layout script and ensures that the setup is correct
> from the beginning. The dojo() view helper will only generate any code
> if it has been re-enabled by your application code later.
> 
>>         echo $this->dojo();
>>     endif; ?>
>>     <?= $this->headScript() ?> 
>> </head>
>> <body class="tundra">
>> 
>> Third, in my view script that gets included later I add the following:
>> 
>> <?php 
>> echo $this->dateTextBox(
>>     'foo',
>>     '2008-07-11',
>>     array('required' => true)
>> ); ?>
>> 
>> When I render that view, all I get is the following in the source:
>> 
>> <input id="foo" name="foo" value="2008-07-11" type="text" />
> 
> This is correct -- dijit creation is programmatic by default, which
> means that you'll have standard, valid HTML by default.
> 
>> I checked the head URLs in the source and they are all correct:
>> 
>> <head>
>>     <title>GGV</title> 
>>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
>>     <link href="/GGV/www/css/common.css" media="screen" rel="stylesheet"
>> type="text/css" /> 
>>      
>>     <style type="text/css">
>> <!--
>>     @import "/GGV/www/js/dojo/dijit/themes/tundra/tundra.css";
>> -->
>> </style>
>> 
>> <script type="text/javascript"
>> src="/GGV/www/js/dojo/dojo/dojo.js"></script>
>> 
>>      
>> </head>
> 
> Hm -- looks like the dijit JS was not generated. You should be seeing
> something like the following in an additional <script>:
> 
>     dojo.requireModule("dijit.form.DateTextBox");
>     var zendDijits =
> [{"id":"foo","params":{"required":"true","dojoType":"dijit.form.DateTextBox"}}];
> 
> Did you call Zend_Dojo_View_Helper_Dojo::setUseProgrammatic() at some
> point? If so, what value did you pass it? 
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect       | [EMAIL PROTECTED]
> Zend Framework           | http://framework.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Dijit-view-helper-generates-simple-input-element-for-dateTextBox-tp19282825p19288959.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to