PDA

View Full Version : Pro Map code generated when online.


bunneysan
09-14-2009, 09:37 PM
Hi guys. Firstly, thanks for a great product. The maps are showing fine but I have one enquiry with the Pro Map/Google code being generated. I hope I can explain this clearly enough...

In Dreamweaver, I gather the map code is included like this...

<script type="text/javascript">
/*wagmp*/
<?php include("google_javascript/wagmp_map_2.php"); ?>
</script>

However, when uploaded and online, I check my pages code but the map code doesn't stay in the include function. So it looks like this...

<script type="text/javascript">
/*wagmp*/
function WAMapRef(mapObj) {
this.obj = mapObj;
this.directions = false;
this.icons = [];
this.markers = [];
this.addresses = [];
this.points = [];
this.getPointByAddress = getPointByAddressFunc;
this.addressFailed = true;
return this;
}

function WAMapPoint(theMarker, theAddress, theIcon) {
this.icon = theIcon;
this.marker = theMarker;
this.address = theAddress;
return this;
}

function getPointByAddressFunc(value,attname) {
if (!attname) attname = "street";
for (var x=0; x < this.addresses.length; x++) {
if (eval("this.addresses[x]."+attname) == value) {
return WAMapPoint(this.markers[x],this.addresses[x],this.icons[x]);
}
}
return false;
}

function getHTTPObject(){
if (window.ActiveXObject)
return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest)
return new XMLHttpRequest();
else {
return null;
}
}

function searchCache(searchStr, zip) {
var xmlDoc = null;
if (window.ActiveXObject) {//IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
} else if(navigator.userAgent && navigator.userAgent.toLowerCase().indexOf('webkit' ) >= 0) { //webkit (Safari, Chrome)
var coordinates = '';
xmlDoc = getHTTPObject();
if(xmlDoc) {
xmlDoc.onreadystatechange = function() {
if(xmlDoc.readyState == 4) {
var x = xmlDoc.responseXML.getElementsByTagName("geocode_entry");
var geocode, id;
searchStr = searchStr.replace(/,/g, ''); //remove commas
for (i=0; i < x.length; i++) {
id = x[i].getAttribute("ID");
if (id == searchStr) {
coordinates = x[i].getElementsByTagName("geocode")[0].childNodes[0].nodeValue;
return coordinates;
}
}
}
};
xmlDoc.open("GET", "_promaps_cache/_promaps_geocache.xml", false);
xmlDoc.send(null);
}

return coordinates;
} else if (document.implementation.createDocument) {//gecko (Mozilla, Firefox, Opera)
xmlDoc=document.implementation.createDocument("","",null);
} else {
return '';
}
if (xmlDoc != null) {
xmlDoc.async=false;
if(xmlDoc.load("_promaps_cache/_promaps_geocache.xml")) {
var x=xmlDoc.getElementsByTagName("geocode_entry");
var geocode, id;
searchStr = searchStr.replace(/,/g, ''); //remove commas
for (i=0; i < x.length; i++) {
id = x[i].getAttribute("ID");
if (id == searchStr) {
return x[i].getElementsByTagName("geocode")[0].childNodes[0].nodeValue;
}
}
}
}

return '';
}
etc/etc/etc


I'm just wondering if this is normal when the page is accessed.
My main concern is that with all the code generated at the start of the page it will affect SEO.
Is there any way to externalize this code? I thought the php include function is used for this.

Kind of new to all this, so any help would be greatly appreciated. Cheers

Jason Byrnes
09-15-2009, 09:58 AM
Yes, this is normal. The contents of the php include file are written to the top of the page when you browse to it. There may be a bit of an SEO drawback to this, some search engines will only parse the first 20 lines of your page.

In reality, the map will most likely be placed on the something like the contact us page. It is not really important in most cases for the contact us page to be prominent in SEO. You should concentrate more on the home page and include navigation links to the contact us page.