I need some (I hope) very basic help in getting dojo up and working and some
notion of how to do not have to use the declarative syntax would also be
great.

Here are the contents of the files in question:
bootstrap.php:
-------------
<?php 
// ** Check to see if the environment is already setup **
if (isset($bootstrap) && $bootstrap) { 
    // Enable all errors so we'll know when something goes wrong. 
    error_reporting(E_ALL | E_STRICT);  
    ini_set('display_startup_errors', 1);  
    ini_set('display_errors', 1); 
 
    set_include_path('../library');  
 
    require_once "Zend/Loader.php"; 
    Zend_Loader::registerAutoload(); 

} 

 
$frontController = Zend_Controller_Front::getInstance(); 
$frontController->setControllerDirectory('../application/controllers'); 
$frontController->setParam('env', 'development');

// set up dojo helper
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->initView();
Zend_Dojo::enableView($viewRenderer->view); 

//set up the layout
Zend_Layout::startMvc(array('layoutPath' =>
'../application/views/layouts'));
-------------

layout.phtml:
-------------
<?php echo $this->doctype('XHTML1_STRICT'); ?>

<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
<?php echo $this->headTitle(); ?> 
<?php echo $this->headMeta(); ?> 
<?php echo $this->headLink(); ?> 
<?php echo $this->headStyle(); ?> 
<?php 
  if ($this->dojo()->isEnabled()) :
    $this->dojo()->setLocalPath('/js/dojo/dojo/dojo.js')
                 ->addStyleSheetModule('dijit.themes.tundra');
    echo $this->dojo(); 
  endif;
?>
<?php echo $this->headScript(); ?> 
</head>
<body class="tundra">

<?php echo $this->layout()->content; ?>

</body>
</html>
-------------

and the index view, index.phtml
-------------
<?php 
  $this->dojo()->enable()
       ->setDjConfigOption('parseOnLoad', true)
       ->requireModule('dijit.form.Button');
?>

<button dojoType="dijit.form.Button" id="helloButton">
   Hello World!
   <script type="dojo/method" event="onClick">
        alert('You pressed the button');
    </script>
</button>
-------------

What happens: 
The page loads but I get a JavaScript error that says "node is undefined"
coming from bootstrap.js in the dojo library. The page is blank and, looking
at the DOM's view of the HTML (using Firebug) I see only:<div
style="display: none;"/>

So, something is wrong, but I sure can't figure out what.

Also, if someone has a fix for this, I would certainly appreciate an example
of rendering out the same button example but programmatically. I would
rather not have all those proprietary attributes in the button code.

Many thanks,
ken



-- 
View this message in context: 
http://www.nabble.com/Basic-dojo-help-and-programmatic-dojo-example-tp19319767p19319767.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to