2009年3月31日星期二

Re: [fw-mvc] Getting dojo to work

No, it is possible. The key here is keeping the relative/absolute paths
lined up. the djConfig specified should work fine.

I've got /~dante/mixed/base-xd.html and /~dante/mixed/myns/module.js:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>

<title>Sample Dojo / Dijit Page</title>

<!-- load Tundra theme -->

<!-- load Dojo -->
<script>
var djConfig = {
modulePaths:[
"myns", "myns/"
],
baseUrl:"./mixed/"
}
</script>
<script src="http://o.aolcdn.com/dojo/1.3.0/dojo/dojo.xd.js"></script>
<script type="text/javascript">
dojo.require("myns.module");
dojo.addOnLoad(function(){
new myns.ModuleThing({}, "container");
})
</script>

</head>
<body class="tundra">
<div id="container"></div>
</body>
</html>

and module.js:

dojo.provide("myns.module");
dojo.require("dijit._Widget");

dojo.declare("myns.ModuleThing", dijit._Widget, {
postCreate:function(){
// this widget does nothing.
alert("This is nothing.");
}
});

It should entirely be possible. (though when you go to build, you'll
need to use loader=xd

Regards,
Peter

Matthew Weier O'Phinney wrote:
> -- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
> (on Tuesday, 31 March 2009, 09:52 PM +0200):
>
>> I'm having a few problems to setup dojo with a module I'm using ; here's my
>> code :
>>
>>
>> $this->dojo()->setCdnBase( Zend_Dojo::CDN_BASE_GOOGLE )
>> ->setCdnDojoPath( Zend_Dojo::CDN_DOJO_PATH_GOOGLE )
>> ->addStyleSheetModule( 'dijit.themes.tundra' )
>> ->setDjConfigOption('parseOnLoad', true)
>> ->setDjConfigOption('debug', true)
>> ->setDjConfigOption('debugAtAllCosts', true)
>> ->registerModulePath('baseUrl', '/')
>> ->registerModulePath('dge', '/scripts/dge')
>> ->useCdn();
>>
>> Now the cdn is working ok, but I can't use the dge module. I don't know if the
>> baseUrl is supposed to work this way.
>> I'm trying to get the following result :
>>
>> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo
>> /1.2.3/dojo/dojo.xd.js.uncompressed.js"
>> djConfig="parseOnLoad: true, baseUrl: './', modulePaths: {dge: '../scripts/
>> dge'}, debug:true, debugAtAllCosts:true"></script>
>>
>> Any idea how ?
>>
>
> IIRC, you cannot mix local modules with CDN -- you either have to use
> only the CDN OR use all local resources.
>
>


--
Peter E Higgins
Dojo Project Lead : http://dojotoolkit.org

没有评论: