<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o$
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<title>Maptest</title>
<?
require('GoogleMapAPI.class.php');
$map = new GoogleMapAPI();
$map->setAPIKey($apikey);
$map->setCenterCoords(-0.435, 53.841);
$map->setZoomLevel(13);
$map->printHeaderJS();
$map->printMapJS();
?>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
</head><body onload="onLoad()">
<p>Map</p>
<? $map->printMap(); ?>
</body></html>
David,
Google sitemaps are for submitting your site to Google’s index. Google maps are for displaying interactive, multi-layered maps on your web site. Thanks for replying though. Hopefully I can take advantage of this PHP API. Using a module perhaps?
Andy
[[googlemap?id=bigmap&width=700&height=500]] [[googlemap?id=smallmap&width=200&height=200]]
// outputs a google map
// parameters:
// id = id of div tag
// width, height = width and height of map
// defaults:
$default_id = 'map';
$default_width = 300;
$default_height = 300;
// notes:
// add [+googlemapheader+] before </head> tag
// add [+googlemapfooter+] before </body> tag
$id = (isset($id)) ? $id : $default_id;
$width = (isset($width)) ? $width : $default_width;
$height = (isset($height)) ? $height : $default_height;
// get current header
$header = $modx->getPlaceholder('googlemapheader');
// if no header defined then define and add one
if (!strlen($header))
{
$header = '<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAwCGFNcsQZZaar4Ag_DD-TxRbjNzHaNEcWlqcrBNeLWsaQm0mURRkPNBjzXqEboBCoirHKg_hYUaj3w" type="text/javascript"></script>'."\n";
$header .= '<style type="text/css">'."\n";
$header .= ' v\:* {'."\n";
$header .= ' behavior:url(#default#VML);'."\n";
$header .= ' }'."\n";
$header .= '</style>'."\n";
$modx->setPlaceholder("googlemapheader", $header);
}
// get current footer
$footer = $modx->getPlaceholder('googlemapfooter');
// if no footer defined then define start
if (!strlen($footer))
{
$footer = '<script type="text/javascript">'."\n";
$footer .= '//<![CDATA['."\n";
$footer .= '// Creates a marker at the given point with the given number label'."\n";
$footer .= 'function createMarker(point, name, url) {'."\n";
$footer .= ' var marker = new GMarker(point);'."\n";
$footer .= ' GEvent.addListener(marker, "click", function() {'."\n";
$footer .= ' marker.openInfoWindowHtml("<b>" + name + "</b><br><small><a href=\"" + url + "\">View image</a>");'."\n";
$footer .= ' });'."\n";
$footer .= ' return marker;'."\n";
$footer .= '}'."\n";
$footer .= '//]]>'."\n";
$footer .= '</script>'."\n";
}
$footer .= '<script type="text/javascript">'."\n";
$footer .= '//<![CDATA['."\n";
$footer .= 'var '.$id.' = new GMap2(document.getElementById("'.$id.'"));'."\n";
$footer .= $id.'.addControl(new GLargeMapControl());'."\n";
$footer .= $id.'.setCenter(new GLatLng(53.841, -0.435), 13);'."\n";
$footer .= 'var point = new GLatLng(53.841, -0.435);'."\n";
$footer .= $id.'.addOverlay(createMarker(point, "Guildhall", "guildhall.html"));'."\n";
$footer .= 'point = new GLatLng(53.851, -0.425);'."\n";
$footer .= $id.'.addOverlay(createMarker(point, "Minster", "minster.html"));'."\n";
$footer .= '//]]>'."\n";
$footer .= '</script>'."\n";
$modx->setPlaceholder("googlemapfooter", $footer);
$map = '<div id="'.$id.'" style="width: '.$width.'px; height: '.$height.'px;"></div>';
return $map;

I discovered them too late...