View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

PHP/MySQL errors in wagmp_map file

Thread began 12/04/2009 10:57 am by millerb395386 | Last modified 12/07/2009 6:37 pm by millerb395386 | 2175 views | 14 replies

millerb395386

Note: I removed function definitions in the prologue as the snippet was too long for the forum.

function wagmp_map_1() {
if(GBrowserIsCompatible()) {
if(!document.getElementById('wagmp_map_1')) return false;
var map = new GMap2(document.getElementById('wagmp_map_1'));
wagmp_map_1_obj = new WAMapRef(map);
map.enableContinuousZoom();
map.enableDoubleClickZoom();
map.addControl(new GSmallMapControl());
var geocoder = new GClientGeocoder();

var fromAddress = {
enabled: false,
street: '',
city: '',
state: '',
zip: '',
country: '',
full: ''
};

var icon_0 = new GIcon();
icon_0.image = 'plugins/google_javascript/images/traditionalflat_pacifica.png';
icon_0.shadow = 'google_javascript/images/traditionalflat_shadow.png';
icon_0.iconSize = new GSize(34,35);
icon_0.shadowSize = new GSize(34,35);
icon_0.iconAnchor = new GPoint(9,33);
icon_0.infoWindowAnchor = new GPoint(19,0);
icon_0.printImage = 'plugins/google_javascript/images/traditionalflat_pacifica.gif';
icon_0.mozPrintImage = 'plugins/google_javascript/images/traditionalflat_pacifica_mozprint.png';
icon_0.printShadow = 'google_javascript/images/traditionalflat_shadow.gif';
icon_0.transparent = 'google_javascript/images/traditionalflat_pacifica_transparent.png';

<?php $Google_recordset_id = 0; ?>
<?php do { ?>
var address_0_<?php echo $Google_recordset_id; ?> = {
street: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['business_address'] .""); ?>',
city: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['city'] .""); ?>',
state: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['state'] .""); ?>',
zip: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['zip'] .""); ?>',
country: '',
infowindow: 'custom',
infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><?php echo str_replace("'", "\'", "<strong>Reported Merchant:</strong><br />".$row_Google_Recordset['business_name'] ."<br />".$row_Google_recordset['business_address'] ."<br />".$row_Google_recordset['city'] .", ".$row_Google_recordset['state'] ." ".$row_Google_recordset['zip'] .""); ?></span>',
full: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['business_address'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['city'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['state'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['zip'] .""); ?>',
isdefault: true,
addressType: 'address',
loop: 'Google_recordset',
latitude: '',
longitude: '',
markerStyle: 'Google Traditional (flat)',
markerColor: 'Pacifica'
};

if (address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates") {
var cacheReturn = '';
} else {
var cacheReturn = searchCache(address_0_<?php echo $Google_recordset_id; ?>.full, address_0_<?php echo $Google_recordset_id; ?>.zip);
}
if (cacheReturn != "" || (address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates")) {
if(address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates") {
var latitude = address_0_<?php echo $Google_recordset_id; ?>.latitude;
var longitude = address_0_<?php echo $Google_recordset_id; ?>.longitude;
} else {
var latitude = cacheReturn.substring(1,cacheReturn.indexOf(",")-1);
var longitude = cacheReturn.substring(cacheReturn.indexOf(",")+1,(cacheReturn.length)-1);
}
var point = new GLatLng(latitude, longitude);
if (point && !isNaN(latitude)) {
wagmp_map_1_obj.addressFailed = false;
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if(!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
map.setZoom(12);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);
} else {
if (wagmp_map_1_obj.addressFailed) {
map.setCenter(new GLatLng(30, -98), 3);
}
wagmp_map_1_obj.addressFailed = true;
}
} else if (address_0_<?php echo $Google_recordset_id; ?>.addressType == "address") {
geocoder.getLatLng (
address_0_<?php echo $Google_recordset_id; ?>.full,
function(point) {
if(point) {
this.addressFailed = false;
addToCache(address_0_<?php echo $Google_recordset_id; ?>.full, '', point);
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if(!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);

} else {
var noZipAddress = address_0_<?php echo $Google_recordset_id; ?>.full.replace((address_0_<?php echo $Google_recordset_id; ?>.zip+','), '');
geocoder.getLatLng (noZipAddress,
function(point) {
if(point) {
wagmp_map_1_obj.addressFailed = false;
addToCache(address_0_<?php echo $Google_recordset_id; ?>.full, address_0_<?php echo $Google_recordset_id; ?>.zip, point);
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if (!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);

} else {
if (wagmp_map_1_obj.addressFailed) {
map.setCenter(new GLatLng(30, -98), 3);
}
wagmp_map_1_obj.addressFailed = true;
}
}
);
}
}
);
}
<?php $Google_recordset_id++; ?>
<?php } while ($row_Google_recordset = mysql_fetch_assoc($Google_recordset)); ?>
<?php mysql_data_seek($Google_recordset, 0); ?>


}
}

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...