Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Simple Google Maps


Go to End


12 Posts   7993 Views

Avatar
spenniec

Community Member, 37 Posts

30 August 2008 at 4:59pm

Hi
One thing that stands out is that there are 2 script tags for the api and your key.
This one is incorrect
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;keyABQIAAAAs9hPF45AQw42f-3VhD_y4hT55LS6GbizrBzE_RUb_NV-rrad3RRxsRhQ5PCE_NiieNdRPNw2cS398g"></script>

as it is missing the '=' sign after key. Is this in your template file?
Spence

Avatar
Paweł Pierzchała

Community Member, 5 Posts

25 September 2008 at 8:20pm

First thing: spenniec - you did really good job :)

I had the same problem - the map didn't show up... but now it works :)
Tho only thing you have to do is add <body onload="load()" onunload="GUnload()">

so my code looks:
...
<body onload="load()" onunload="GUnload()">
$GetGoogleMapsScript
<div id="Map" style="width: 500px; height: 300px"></div>
</body>
...

that's it :)

Avatar
potion_maker

Community Member, 36 Posts

10 October 2008 at 1:14pm

Speniec,
Sorry I didn't post a thank you sooner. Your advice was very helpful. You were right I was missing the '=' sign. Silly mistake. Anyway thanks again!

Avatar
potion_maker

Community Member, 36 Posts

26 November 2008 at 11:49am

Edited: 26/11/2008 4:36pm

So i figured out a way around this once before but recently updated my silverstripe build to 2.2.3 and am having the problem again. My map works fine in IE7 but won't show up in FF or Safari. It seems like there is an issue with a double quote in the wrong place or something. I'm just wondering if anyone else has had a similar problem when dealing with the gMapPage.php spenniec provided. You can see what I'm working on at jazzat5.org/site/location/. If you check out the source you'll see FF shows all of the script code in pink.

I've copied the code from the view source page FF creates and plugged/posted it as a .html page. When I view it the map it shows up. There is literally no change between the code generated and read by FF the first time or the code works.

Any thought would be greatly appreciated. Also Spenniec, your example link http://www.mccauleys.co.nz/ no longer works. It turns up the following error:
Fatal error: Class 'Page' not found in /home/.mummy/cms_dc/2.2.1/cms/code/PageTypes/UserDefinedForm.php on line 3

Go to Top