On Wed, Dec 8, 2010 at 07:06, Nandan Bagchee <[email protected]> wrote:
>
>> I would like to use openlayers to draw some maps. But, I have problems
>> understanding how to embed any javascript code. For example, how would
>> you create the following html code, or something like this?
>
> There may be some answers at https://github.com/nunb/map.widget which
> uses google maps.

Great, that's exactly what I needed!

> I would suggest rendering the div (html above) using a widget, and
> using YUI.Get (or similar) to load an external script resource in the
> page head. Put all calls to OpenLayers inside the fn. that is called
> by YUI.Get *after* the OpenLayers script object is available.

I've come across YUI when I was looking through the weblocks examples
and contrib. Could you tell me what are the advantages of using this
compared to "pure weblocks"?

>> on the entire page, and in the source ther is no trace of the javascript 
>> code.
>>
>> Do I have to create an widget? And in what way? Or something else?
>
> After experimenting with embedding all the js code inside lisp (using
> parenscript) I've found that external js files, in conjunction with a
> widget, actually work better (ymmv).
>
> 0) Create a weblocks widget foo -- it should draw the minimal div
> required, with a fixed class/id.
> 1) abstract as much as you can of the required JS into foo.js --
> preferably creating a namespace & an object within that, and set
> foo.js to be automatically loaded when your weblocks widget foo is
> loaded using the dependencies fn.
> 2) Use with-html to render your foo-widget -- but whatever js calls
> you make from there for any external library should only happen once
> that library is loaded.

Thank you very much! I think I understand it a bit better now.

-- 
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en.

Reply via email to