3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1885 Views |
-
adding google maps to page template

20 November 2009 at 7:28am
Hello folks,
I´m new to silverstripe and I can´t find a way to make google maps run in my Page Template. I tried the jquery code found on this site: http://marcgrabanski.com/article/jquery-google-maps-tutorial-basics
The code runs perfect in a single html file I created for testing. But in silverstripe FireFox reports an JS error like this:
Error: google.maps is undefined
It seems like the source for googlemaps is not visible to my site. Actually I´m not sure where to place the link to the google js. I always placed my js files that i need in the whole application in Page.php like this:
Requirements::javascript("http://www.google.com/jsapi?key=KEYHERE");
That worked for all the other files, but fails for google. Is there a special way to include external js files?
Thanks very much for your help,
Florian -
Re: adding google maps to page template

20 November 2009 at 7:48am Last edited: 20 November 2009 7:51am
ah here more Info: thats my code in my js file:
google.load("maps", "2.x");
google.load("jquery", "1.3.1");function initGoogle(){
var map = new GMap2(document.getElementById('map'));
var burnsvilleMN = new GLatLng(44.797916,-93.278046);
map.setCenter(burnsvilleMN, 8);
}and in Page.php i have this to embed the google js and jquery:
Requirements::javascript("http://www.google.com/jsapi?key=KEYHERE");
Requirements::javascript("http://code.jquery.com/jquery-latest.js");The JS Error that my browser shows at the moment is:
GMap2 is not defined
So it seems my site finds google js source... but just does not know what GMap2 is.
Greetz,
Florian -
Re: adding google maps to page template

20 November 2009 at 8:10am
this post solved my problem. after I saw that in IE googlemaps appears... the problem must have been something else:
http://www.silverstripe.org/archive/show/1449
nice forum!
thanks,
florian
| 1885 Views | ||
|
Page:
1
|
Go to Top |

