By stubob on
Hi everyone, just thought I'd post a quick workaround for getting a Google map in Drupal 6.x. Forgive me if this really obvious.
What I did was create a story and paste the Google maps code into it. Surely not on the same level as the GMaps module, but if you want a quick and dirty map, it should work for you. My page content looks like this:
<script src="http://maps.google.com/maps?file=api&v=2&key=google key"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.setCenter(new GLatLng(39.728940, -104.990610), 9);
var point = new GLatLng(39.554558, -105.096250);
var marker = new GMarker(point);
map.addOverlay(marker);
}
}
//]]>
</script>
<div id="map" style="width: 600px; height: 400px"></div>
Hope that helps, and please let me know if I'm doing something really wrong with this approach.
Comments
looks ok to me :) but i use
looks ok to me :)
but i use gmap and get the same results..
Gmap is very easy to install etc , and gives you the option of tieing a location to a node and then showing the location in a map on the node ;)
nice code tho
when does load() run?
I tried putting this in as well, but everything is done in the load() function, and I don't get where that is called.
In google's docs they have it set in the body tag's onload event, but how do you do that in a story?
Just get the code above...
Just get the code above... grab it by the ba*ls and fire it directly onto the body bit of your story... put it all in as it is above.
THEN....
look under the body part and find "Input Format" expand this bit and click "Full HTML"
Click save and it should display a map...
doesnt work for me. i just
doesnt work for me. i just copied the entire code (changing to my api key) but i get nothing. im running the latest stable release.
im new to drupal and google maps, so probably something basic i am not doing right. do i need to change anything other than the api for this code to work on my site?
also, there has been some mention of having to put the script src="http://maps.google.com/maps?..." line between head tags.. not sure if thats relevant.
thanks!