Re: Help with Google Maps
Posted: Tue Aug 23, 2005 2:46 am
Weird one...
Try changing & to & in the google API url.
Try changing & to & in the google API url.
Content management as it is meant to be
https://forum.cmsmadesimple.org/
Code: Select all
print '<div id="map" style="width: 650px; height: 650px"></div>' ."\n";
print '<__script__ type="text/javascript">' ."\n";
print '//<![CDATA[' ."\n";
print 'var map = new GMap(document.getElementById("map"));' ."\n";
print 'map.addControl(new GLargeMapControl());' ."\n";
print 'map.centerAndZoom(new GPoint(-3.63, 52.37), 9);'."\n";
print 'var marker1 = new GMarker(new GPoint(-3.11216, 51.63512)); map.addOverlay(marker1);'."\n";
print 'GEvent.addListener(marker1, "click", function(){marker1.openInfoWindowHtml("<a href=\"http://www.mbwales.com/cwm_carn/index.htm\">Cwm Carn</a");});'."\n";
print '//]]>'."\n";
print '</__script>'."\n";Code: Select all
echo '
<div>
<__script__>
etc
</div>
';
Code: Select all
{MapStart}{MapDataChallengeTrailsWales}{MapDataChallengeTrailsEngland}{MapDataChallengeTrailsScotland}{MapDataEnd}Code: Select all
<__script__ src="http://maps.google.com/maps?file=api&v=1&key=xxxx" type="text/javascript"></__script>
Code: Select all
echo '
<__script__ type="text/javascript">
//<![CDATA[
var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.centerAndZoom(new GPoint(-2.95, 54.5), 11);
';
Code: Select all
$data = file("/usr/local/xxx/yyy/zzz/mapdata/Wales.txt");
$marker = 200;
foreach ($data as $line)
{
$marker = $marker + 1;
// Expect to read a line like: Coed y Brenin, Dolgellau::52.798329::-3.899949::www.mbwales.com/coed_y_brenin::www.streetmap.co.uk/blah::4::5
// i.e. name::lat::long::url:mapurl::trailrating:facilitiesrating
// 0 1 2 3 4 5 6
// want to print: long lat
// var marker1 = new GMarker(new GPoint(-3.11216, 51.63512));
// map.addOverlay(marker1);
// GEvent.addListener(marker1, "click", function() {
// marker1.openInfoWindowHtml("<a href=\"http://www.mbwales.com/cwm_carn/\">Cwm Carn</a>"); });
$fields = explode("::", $line);
echo 'var marker'.$marker.' = new GMarker(new GPoint(';
echo $fields[2]; // long
echo ', ';
echo $fields[1]; // lat
echo '));
map.addOverlay(marker'.$marker.');
GEvent.addListener(marker'.$marker.', "click", function() {
marker'.$marker.'.openInfoWindowHtml("<a href=\"http://';
echo htmlspecialchars($fields[3]);
echo '\" target=\"_new\" >';
echo $fields[0];
echo '</a><br/><a href=\"http://';
echo htmlspecialchars($fields[4]);
echo '\" target=\"_new\" >OS map</a>';
echo '<br/>Trails: ';
for ( $i = 0; $i < $fields[5]; $i++) { echo '∗' ;}
echo ' ';
echo 'Facilities: ';
for ( $i = 0; $i < $fields[6]; $i++) { echo '∗' ;}
if (strcmp($fields[7],"Y") == 0)
{ echo '<br/><a href=\"/index.php?page=Shop_Publications\">Leaflet available from IMBA-UK</a>'; };
echo '"); });
';
};
Code: Select all
var marker201 = new GMarker(new GPoint(-3.703029, 51.642785));
map.addOverlay(marker201);
GEvent.addListener(marker201, "click", function() {
marker201.openInfoWindowHtml("<a href=\"http://www.mbwales.com/afan_forest\" target=\"_new\" >Afan Argoed, Swansea</a><br/><a href=\"http://www.streetmap.co.uk/streetmap.dll?G2M?X=282255&Y=195150&A=Y&Z=4\" target=\"_new\" >OS map</a><br/>Trails: ∗∗∗∗∗ Facilities: ∗∗∗∗<br/><a href=\"/index.php?page=Shop_Publications\">Leaflet available from IMBA-UK</a>"); });
var marker202 = new GMarker(new GPoint(-4.060395, 51.984224));
map.addOverlay(marker202);
GEvent.addListener(marker202, "click", function() {
marker202.openInfoWindowHtml("<a href=\"http://www.forestry.gov.uk/website/ourwoods.nsf/LUWebDocsByKey/WalesCarmarthenshireNoForestBrechfaAbergorlechPicnicSiteAbergorlechRedMountainBikeTrail\" target=\"_new\" >Brechfa, Llandovery</a><br/><a href=\"http://www.streetmap.co.uk/streetmap.dll?G2M?X=258603&Y=233757&A=Y&Z=4\" target=\"_new\" >OS map</a><br/>Trails: ∗∗∗ Facilities: ∗"); });
...
etc
...
var marker210 = new GMarker(new GPoint(-3.885300, 52.414151));
map.addOverlay(marker210);
GEvent.addListener(marker210, "click", function() {
marker210.openInfoWindowHtml("<a href=\"http://www.mbwales.com/nant_y_arian\" target=\"_new\" >Nant yr Arian, Aberystwyth</a><br/><a href=\"http://www.streetmap.co.uk/streetmap.dll?G2M?X=271870&Y=281245&A=Y&Z=4\" target=\"_new\" >OS map</a><br/>Trails: ∗∗∗∗ Facilities: ∗∗∗<br/><a href=\"/index.php?page=Shop_Publications\">Leaflet available from IMBA-UK</a>"); });
Code: Select all
echo '
//]]>
</__script>
';Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>IMBA UK - {title}</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
{stylesheet}
</head>
</__body>
<div id="top"><img src="/uploads/images/WebHead.gif" alt="" /></div>
<div class="leftsidebar"> {cms_module module='cssmenu'} </div>
<div class="thebody">
<!-- Nasty hack to workaround IE bug: moved "content" down to end of body -->
<!-- so that page loads before Google's Javascript starts running -->
<br/>
<h4>MTB Challenge Trails</h4>
<div id="map" style="height:700px"></div>
</div>
{content}
<__body>
</__html>
Code: Select all
body {
color: #000000;
background-color:#FFFFFF;
font-size: 80%;
font-family: helvetica, verdana, arial, sans-serif;
margin: 0;
}
h1 {font-weight: bold; font-size: 1.80em; }
h2 {font-weight: bold; font-size: 1.60em; }
h3 {font-weight: bold; font-size: 1.40em; }
h4 {font-weight: bold; font-size: 1.20em; }
h5 {font-weight: bold; font-size: 1.00em; }
a:link {color: #0000FF;}
a:visited {color: #0000FF;}
a:hover {
color: #FFFFFF;
background-color: #000077;
text-decoration: none;
}
a:active {
color: #FF0000;
background-color: #000077;
text-decoration: none;
}
#top
{
padding: 0;
border-bottom: 1px solid #000077;
text-align: left;
background-color:#C6DBEF;
}
div.leftsidebar {
width: 170px;
background-color: #6B9EBD;
background-color: #C6DBEF;
padding: 0px;
color: #000077;
z-index: 9999;
position: absolute;
top: 110px;
left: 0px;
}
.breadcrumbs {
font-size: 8pt;
margin-left: 174px;
padding: 2px 0 2px 9px;
color: #000077;
text-transform: uppercase;
}
div.thebody {
padding: 0px;
z-index: 1 ;
position: absolute;
top: 110px;
left: 170px;
width: 100%;
}
div.imbacontent {
margin-left: 9px;
margin-right: 12px;
margin-bottom: 25px;
}