Lift With OpenLayers Timing -
i have simple lift "application" attempts display statically openlayers map in anticipation of having comet dynamically add markers map based on server-side logic. in case, having map show @ proving difficult task.
the html follows:
<!doctype html> <html> <head> <title>test</title> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/bootstrap-responsive.min.css"> <link rel="stylesheet" href="css/main.css"> <script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script> <script src="http://www.openlayers.org/api/openlayers.js"></script> <script> function init() { map = new openlayers.map("mainmap"); var mapnik = new openlayers.layer.osm(); var fromprojection = new openlayers.projection("epsg:4326"); // transform wgs 1984 var toprojection = new openlayers.projection("epsg:900913"); // spherical mercator projection var position = new openlayers.lonlat(-76.6778,39.2652).transform( fromprojection, toprojection); var zoom = 9; map.addlayer(mapnik); map.setcenter(position, zoom ); } </script> </head> <body class="lift:content_id=main" onload="init();"> <div id="main" class="lift:surround?with=bootstrap;at=content"> <div id="mainmap"> </div> </div> </body> </html>
i having difficult time understanding lift-generated head , body elements coming after lift:surround has worked magic. though static html looks fine, pertinent script elements gone , there seems no way invoke init() in order have map appear.
do have override surround snippit somehow, avoid using @ all, or construct of init() javascript within snippit , invoke somehow? or else? bit of lift newbie please bear me if way off base ;)
one other thing tried adding relevant head / script html code in bootstrap.html file using surround posted page, , doesn't me want either.
edit: there (usual) caching issue preventing me seeing changes bootstrap.html file specified lift:suround snippit. did work.
did read >5 pages lift?... when type content_id=main, tell lift ignore except inner part of <div id="main">
. so, work, place <head_merge>
scripts inside <div id="main">
.
Comments
Post a Comment