views:

65

answers:

0

I'm having a strange issue: I've used Zend Dojo and Zend Form to great effect in the past, but on my most recent project Zend_Dojo refuses to enable unless forced to in the view, and even then won't import the appropriate libraries for the dijits I'm using. Here is the applicable code:

Bootstrap.php:

protected function _initViewHelpers() {
 $this->bootstrap('layout');

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

    $view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');

    $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();

    $viewRenderer->setView($view);

 Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);

 $view->doctype('XHTML1_TRANSITIONAL');

 $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
 $view->headLink()->appendStylesheet('base.css');
}

IndexController.php (excerpt from some other unrelated stuff)

public function renderAction() {
$this->_helper->layout->setLayout('render');
//SNIP
if ($this->getRequest()->getParam("medialeadsource"))
 {
  $source = $this->getRequest()->getParam("medialeadsource");
  $mls = $this->sourceService->getSourceByURI($source);
  $this->view->source = $mls;
  $form = new App_forms_Sweepstakes($mls->__get('id'), $mls->__get('layout'));

  $this->view->form = $form;   
  switch($mls->__get('template')) {
   case '1':
    $this->_helper->viewRenderer('template-1');
    break;
   case '2':
    $this->_helper->viewRenderer('template-2');
    break;
   case '3':
    $this->_helper->viewRenderer('template-3');
    break;
   default:
    $this->_helper->viewRenderer('template-1');
    break;
  }
  $this->view->test = $this->sourceService->isURISlideshow($source);
  $this->view->subheadline = $mls->__get('subheadline');
  $this->view->body = $mls->__get('body');
  Zend_Dojo::enableView($this->view);
  Zend_Dojo::enableForm($form);
  Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); 
//SNIP
}

And from template-1.phtml (the only view I've setup for Dojo so far. Also note that for these specific views the layout itself is devoid of any content of its own and therefore is not impacting matters). I'm only including the applicable portion, again:

<?php   
      $this->dojo()->setDjConfigOption('usePlainJson',true)
         ->addStylesheetModule('dijit.themes.tundra');
    echo $this->dojo();

?>  
</head>
<body class="tundra">

The generated code is as follows:

<title>Test View Title</title>
</head>
<body class="tundra">

So obviously, nothing going on.. If I add ->enable() to dojo chain in the view, here's what I get:

<script type="text/javascript" src="primaryFunctions1.js"></script>
<style type="text/css">
<!--
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dijit/themes/tundra/tundra.css";
-->
 </style>
 <script type="text/javascript">
//<![CDATA[
var djConfig = {"usePlainJson":true,"parseOnLoad":true};
//]]>
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js"&gt;&lt;/script&gt;

<title></title>
</head>
<body class="tundra">

So still no dijit imports. I'm at a loss!