2009-08-31 1 views
1

私は奇妙な問題を抱えています:これまでZend DojoとZend Formを使っていましたが、私の最近のプロジェクトでは、Zend_Dojoは強制的に表示しない限り有効にしません。私が使用しているdijitsのための適切なライブラリ。Zend_Dojoを有効にしたり、読み込んだりしないのはなぜですか?

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(いくつかの他の無関係のものから抜粋)

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 
} 

そしてテンプレート1.phtml(専用ビューからここで該当コードがありますこれらの特定のビューでは、レイアウト自体にはそれ自身のコンテンツがないため、問題には影響しません)。私は再び、該当する部分を含めている:次のように

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

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

生成されたコードは次のとおりです。

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

をので、明らかに、何が起こっていない..私は追加する場合は - >有効()道場しますチェーンのビューでは、ここに私が得るもの:

<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"></script> 

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

それでもdijitのインポートはありません。私は迷っています!

答えて

1

あなたの問題は、import/requireが$ form-> render()の後に作成されるということに関連していると思います。レイアウトスクリプトを使用することで、この問題を回避することができます。しかし、今日では、レイアウトの中にborderContainersやその他のdojoがあることがあります。

関連する問題