I've had the exact same problem as the OP - a "node is undefined" javascript
error, when everything appears to be loading correctly. Here's my crack at
it, basically as per http://www.roetgers.org/tag/zend-framework/.
index.php
-------------------------------------------------
set_include_path('.' . PATH_SEPARATOR .
'/home/zend/ZendFramework-1.6.0/library' . PATH_SEPARATOR .
'../application/default/models/' . PATH_SEPARATOR . get_include_path());
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();
Zend_Session::start();
// setup controller
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('../application/default/controllers');
$controller->throwExceptions(true); // should be turned on in development
time
// bootstrap layout
$layout = Zend_Layout::startMvc();
$layout->getView()->addHelperPath('Zend/Dojo/View/Helper/',
'Zend_Dojo_View_Helper');
$layout->setLayoutPath('../application/default/layouts');
$layout->setLayout('main');
// run!
$controller->dispatch();
main.phtml (layout)
-------------------------------------------------
<?php
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo $this->doctype()
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<?php
echo $this->headTitle();
echo $this->headScript();
echo $this->headStyle();
?>
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo
$this->baseUrl();?>/styles/style.css" />
<?
// Check if dojo library is needed
if ($this->dojo()->isEnabled()):
$this->dojo()->setLocalPath('/js/dojo/dojo.js')
->addStyleSheetModule('dijit.themes.tundra');
// Echo out the dojo <script> tags
echo $this->dojo();
endif;
?>
</head>
<body class="tundra">
<h1><?php echo $this->placeholder('title'); ?></h1>
<?php echo $this->layout()->content; ?>
</body>
</html>
index.phtml (view)
-----------------------------------------------------------
<?php
$this->dojo()->enable();
$this->headTitle ( 'test' );
$this->placeholder ( 'title' )->set ( 'test' );
?>
<?
$this->tabContainer ()->captureStart ( 'tab1', array (), array
('style' =>
'width:800px;height:500px;' ) );
// First tab "Dates"
$this->contentPane ()->captureStart ( 'pane1', array (), array
('title' =>
'Dates' ) );
echo $this->form1;
echo $this->contentPane ()->captureEnd ( 'pane1' );
// Second tab "FAQ"
$this->contentPane ()->captureStart ( 'pane2', array (), array
('title' =>
'FAQ' ) );
echo '<h1>FAQ</h1>
<dl><dt>Question 1?</dt><dd>This is my answer 1!</dd></dl>
<dl><dt>Question 2?</dt><dd>Good question, next one.</dd></dl>
<dl><dt>Question 3?</dt><dd>Ok, that\'s enough!</dd></dl>
';
echo $this->contentPane ()->captureEnd ( 'pane2' );
// Third tab "Closable"
$this->contentPane ()->captureStart ( 'pane3', array (), array
('title' =>
'Closable', 'closable' => true ) );
echo 'You can close me!';
echo $this->contentPane ()->captureEnd ( 'pane3' );
// Fourth tab "Splitted"
$this->contentPane ()->captureStart ( 'pane4', array (), array
('title' =>
'Splitted' ) );
$this->splitContainer ()->captureStart ( 'split1', array (),
array
('style' => 'width:250px;height:250px;' ) );
$this->contentPane ()->captureStart ( 'splitpane1', array (),
array () );
echo 'Hey, I am on the left side!';
echo $this->contentPane ()->captureEnd ( 'splitpane1' );
$this->contentPane ()->captureStart ( 'splitpane2', array (),
array () );
echo 'Cool!';
echo $this->contentPane ()->captureEnd ( 'splitpane2' );
echo $this->splitContainer ()->captureEnd ( 'split1' );
echo $this->contentPane ()->captureEnd ( 'pane4' );
echo $this->tabContainer ()->captureEnd ( 'tab1' );
?>
As best as I can tell, it's loading the library just fine. I can browse to
the .js file using the browser, it finds it, the css files load fine, it all
appears to be working exactly as it should, i'm not sure if the generated
dojo.require statements are finding their files, but I assume I'd be seeing
JS errors if they weren't?
I'm going to try updating to the latest version off of the dojo site too and
see if it makes a difference for me, I just thought I'd post in here to let
everyone know that this "node is undefined" error isn't a one off thing,
that it's cropped up more than once. Maybe we're both doing something wrong
here?
--
View this message in context:
http://www.nabble.com/Basic-dojo-help-and-programmatic-dojo-example-tp19319767p19366895.html
Sent from the Zend Framework mailing list archive at Nabble.com.