Help with Google Maps
24 posts by 9 authors in: Forums > CMS Builder
Last Post: January 20, 2010 (RSS)
By ross - February 27, 2009
From what I can tell, your code looks fine. It's hard for me to fully test it of course. I was curious if the map itself is at least showing up. If it is, do you get any points at all? Or do only a few show up? And finally, are you getting any Javascript error message popups?
Could you perhaps post a link to the page on your site? I'd like to see the HTML that is being generated.
Thanks!
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] Help with Google Maps
http://www.idsitepreview.com/map.php
Here is the page I want it on:
http://www.idsitepreview.com/listingDetail.php
I made an iframe in the bottom right of the page where I want the map to show up.
Let me know if you need anything else. Thanks for the reply.
John
Interdimensional Designs
www.covdesigns.com
By ross - February 27, 2009
Thanks!
I viewed the source on map.php page and it looks like the latitude and longitude aren't coming through properly. If you view source on map.php, you'll see:
var point = new GLatLng(,);
Could you double check that you are using the correct variables? The line of code that creates that is:
var point = new GLatLng(<?php echo $listingRecord['latitude'] ?>,<?php echo $listingRecord['longitude'] ?>);
Let me know how you make out :).
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] Help with Google Maps
John
Interdimensional Designs
www.covdesigns.com
Re: [ross] Help with Google Maps
Notice: Undefined variable: listingRecords in /home/content/g/r/e/greenways1/html/map.php on line 43
Warning: Invalid argument supplied for foreach() in /home/content/g/r/e/greenways1/html/map.php on line 43
Here's my source from the map.php page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAzWpdtAJy15_mFvJb9uOTTxSpUoc7Yr5GTKWfF5EG52h_OrBQ8BQO9BWmFxt8DPC9oYhAuCCswFK5YQ"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.778855861649966, -79.98664855957031), 13);
}
Notice: Undefined variable: listingRecords in /home/content/g/r/e/greenways1/html/map.php on line 43
Warning: Invalid argument supplied for foreach() in /home/content/g/r/e/greenways1/html/map.php on line 43
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 200px; height: 200px"></div>
</body>
</html>
Here's my code in dreamweaver:
<?php
require_once "/home/content/g/r/e/greenways1/html/cmsAdmin/lib/viewer_functions.php";
list($mapRecords, $mapMetaData) = getRecords(array(
'tableName' => 'map',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$mapRecord = @$mapRecords[0]; // get first record
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAzWpdtAJy15_mFvJb9uOTTxSpUoc7Yr5GTKWfF5EG52h_OrBQ8BQO9BWmFxt8DPC9oYhAuCCswFK5YQ"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.778855861649966, -79.98664855957031), 13);
}
<?php foreach ($listingRecords as $record): ?>
var point = new GLatLng(<?php echo $mapRecord['latitude'] ?>,<?php echo $mapRecord['longitude'] ?>);
var marker = createMarker(point,'<?php echo htmlspecialchars($record['address'], ENT_QUOTES) ?>, <?php echo htmlspecialchars($record['city'], ENT_QUOTES) ?>')
map.addOverlay(marker);
<?php endforeach; ?>
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 200px; height: 200px"></div>
</body>
</html>
Thanks for all your help
Interdimensional Designs
www.covdesigns.com
Interdimensional Designs
www.covdesigns.com
By ross - February 27, 2009
Could you send me a link to the page you are working on now?
Thanks!
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] Help with Google Maps
By blind2uriz - March 1, 2009
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAzWpdtAJy15_mFvJb9uOTTxSpUoc7Yr5GTKWfF5EG52h_OrBQ8BQO9BWmFxt8DPC9oYhAuCCswFK5YQ"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.778855861649966, -79.98664855957031), 13);
}
var point = new GLatLng(,);
var marker = createMarker(point,'107 N. Wills Ave., Covington')
map.addOverlay(marker);
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 300px"></div>
</body>
</html>
Here's the code of map.php in dreamweaver:
<?php
require_once "/home/content/g/r/e/greenways1/html/cmsAdmin/lib/viewer_functions.php";
list($listingRecords, $listingMetaData) = getRecords(array(
'tableName' => 'listing',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$listingRecord = @$listingRecords[0]; // get first record
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAzWpdtAJy15_mFvJb9uOTTxSpUoc7Yr5GTKWfF5EG52h_OrBQ8BQO9BWmFxt8DPC9oYhAuCCswFK5YQ"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.778855861649966, -79.98664855957031), 13);
}
<?php foreach ($listingRecords as $record): ?>
var point = new GLatLng(<?php echo $listingRecord['latitude'] ?>,<?php echo $listingRecord['longitude'] ?>);
var marker = createMarker(point,'<?php echo htmlspecialchars($record['address'], ENT_QUOTES) ?>, <?php echo htmlspecialchars($record['city'], ENT_QUOTES) ?>')
map.addOverlay(marker);
<?php endforeach; ?>
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 300px"></div>
</body>
</html>
In the view source on the web, it's not pulling the GLatLng info that it needs. But I can't figure out how to get it to work.
Interdimensional Designs
www.covdesigns.com
By ross - March 2, 2009
I think the problem is going to be that you are using two different variables in your code. The lat/long uses:
$listingRecord['latitude']
and for the rest of the values you are using:
$record['address']
I think you'll want to use $listingRecord but double check your code and let me know :).
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] Help with Google Maps
By blind2uriz - March 2, 2009
var marker = createMarker(point,'<?php echo htmlspecialchars($listingRecord['address'], ENT_QUOTES) ?>, <?php echo htmlspecialchars($listingRecord['city'], ENT_QUOTES) ?>')
but I still can't get anything on the GLatLng line. Any more thoughts? Thanks.
John
Interdimensional Designs
www.covdesigns.com