我已經到了一個地步,我的野心已經超過了我在Zend Framework項目中使用PHP的XAMPP發行版來實現Dojo的能力& Mysql作爲Windows 7機器上的開發/測試環境。我真的不知道這是ID10T問題(我)還是系統故障。如果這是我的失敗,我提前道歉。Dojo 1.7上的dojo.xd.js
我試圖使用V1.7版本的Dojo,同時保留在生產環境中(因此避免跳轉到ZF 2等)。我從文檔中知道Dojo V1.7 dojo.xd.js已被dojo.js取代。我的問題在於嘗試使用Dojo的CDN源代碼。
我的網頁道場內容呈現細,但Firebug的顯示錯誤「NetworkError:404未找到 - http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/dojo.xd.js」 &頁面具有以下嵌入在頁面頭:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/dojo.xd.js"></script>
追根溯源問題在我的頁面上表明它是'echo $ this-> dojo;'聲明介紹了這個問題。 在引導文件中更改'setCdnVersion(1.7)'爲'setCdnVersion(1.6)'可以解決問題,但我真的很想使用V1.7 +。
將嵌入的URI粘貼到地址欄中確實會返回未找到的404頁面。 Dogpile沒有提到這個特定的錯誤,我可以看到。 我找不到任何出現的bug報告 - 根據我有限的知識 - 與dojotoolkit.org相關
看起來像Dojo配置我沒有意識到需要使用dojo.js for V1.7(儘管我不確定問題實際存在的位置)。所以,我必須承認,我不知道如何解決這個問題,而不是在集體SO專業知識的擺佈下施展自己的力量。
bootstrap.php中:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
...
protected function _initView()
{
// Initialize view
$view = new Zend_View();
$view->setEncoding('UTF-8');
$view->headMeta()->appendName('Content-Type', 'text/html; charset=UTF-8');
// add dojo helper path to view
$view->addHelperPath('Zend/Dojo/View/Helper','Zend_Dojo_View_Helper');
// configure Dojo view helper, disabled...
$view->dojo()
->disable()
->setCdnVersion(1.7)
->setCdnBase(Zend_Dojo::CDN_BASE_GOOGLE)
->addStyleSheetModule('dijit.themes.tundra')
->setDjConfigOption('parseOnLoad', TRUE)
->setCdnDojoPath(Zend_Dojo::CDN_DOJO_PATH_GOOGLE)
->useCdn();
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
// Return it, so that it can be stored by the bootstrap
return $view;
}
}
在index.phtml:
<head>
<?php echo $this->headLink()->prependStylesheet($this->baseUrl() . '/assets/css/site.css'); ?>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.7/dijit/themes/tundra/tundra.css">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.7/dojox/grid/resources/Grid.css">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.7/dojox/grid/resources/tundraGrid.css">
<?php
// Dojo plug-in enablers ...
echo $this->dojo();
$this->dojo()->enable();
?>
版本信息: XAMPP DIST - V1.7.7(阿帕奇/ 2.2 .21,PHP/5.3.8) Zend Framework dist - V1.11.11
這是我的問題的核心; 'dojo.xd.js'的發生是由框架/ dojo設置中的自動生成的。我沒有明確引用它,它是由'echo $ this-> dojo();'聲明在我的頁面標題中。我的問題是瞭解它在哪裏/如何插入。正如你所說,它暗示了一個ZF錯誤,但我希望其他更好的知情思維比我的理智檢查問題,以防萬一我是我自己缺乏知識的受害者。 –
2012-07-16 17:04:48
它似乎是在Zend/Dojo中硬編碼的。PHP:/ ** * Dojo路徑上的谷歌CDN(以下版本字符串) */ 常量CDN_DOJO_PATH_GOOGLE = '/dojo/dojo.xd.js';所以我認爲你可以通過改變它那裏... – Chris 2012-07-16 18:35:05
或更多個清潔「修理」它,使用輔助方法:setCdnDojoPath設置正確的路徑和名稱... – Chris 2012-07-16 18:36:20