>
> <script type="text/javascript"><!--
> // here is the map definition
> var map, layer;
> function init(){
> map = new OpenLayers.Map('map');
> layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
> map.addLayer(layer);
> map.setCenter(
> new OpenLayers.LonLat(-71.147, 42.472).transform(
> new OpenLayers.Projection("EPSG:4326"),
> map.getProjectionObject()
> ), 12
> );
> }
> //--></script>
>
If you're using jQuery, maybe you can just move the init() function
contents into:
$(function () {
var map, layer;
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
map.addLayer(layer);
map.setCenter(
new OpenLayers.LonLat(-71.147, 42.472).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 12
);
});
and put that after the {{extend 'layout.html'}} (still inside the script
tag, of course). In that case, the code won't be run until the document
ready event.
Anthony