Well, this one below is working for me (on localhost, so my key is abdedfg ;) ):
<div id="map_canvas" style="width: 500px; height: 300px"></div> <script src="http://maps.google.com/maps? file=api&v=2&key=abcdefg&sensor=true" type="text/javascript"> </script> <script type="text/javascript"> function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(<?php echo $specialPage['SpecialPage'] ['GoogleLatitude']; ?>, <?php echo $specialPage['SpecialPage'] ['GoogleLongitude']; ?>), 12); } } $(document).ready(function() { initialize(); });/* document ready */ </script> Those should be changed with numerical values: $specialPage['SpecialPage']['GoogleLatitude']; $specialPage['SpecialPage']['GoogleLongitude']; This is just copy paste from Google API, but always work ;) Btw, as you can see you can use &javasrcript('google.js', true); so it's inline Below is jQuery standard function called when document is ready (page loads). $(document).ready(function() { initialize(); });/* document ready */ If you're not using jQuery, you should have call to initialize() here: <body onload="initialize()" onunload="GUnload()"> On Nov 17, 5:19 am, Lance Willett <[email protected]> wrote: > Hi Julia, > When you are using $javascript->link you will generally want the > script to be called in the head of the document (not inline). Which > means adding "false" as the second parameter: > seehttp://api.cakephp.org/class/javascript-helper#method-JavascriptHelpe.... > > Calling the Google Maps script inline could be causing the issue. > > On Nov 16, 5:04 pm, Julia <[email protected]> wrote: > > > Hi, > > > I have been fighting with GoogleMap vs. CakePHP for a few hours. > > I have a layout in which I call:- > > > $url = 'http://maps.google.com/maps?file=api&v=2&key=MYKEY'; > > echo $javascript->link($url); > > > when I attempt to display a page using this layout, the brower hangs > > displaying "Read maps.gstatic.com" in the status bar. > > > I cannto see any error in Firebug, > > > What's more, if I call "http://maps.google.com/maps? > > file=api&v=2&key=MYKEY" in my browser window, it displays well. > > > Any help wouold be greatly appreciated. > > -- You received this message because you are subscribed to the Google Groups "CakePHP" 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/cake-php?hl=.
