Hello, I'm a bit stuck I've successfully created a dealer database following the example here - http://code.google.com/apis/maps/articles/phpsqlsearch.html
and i've read http://www.geocodezip.com/v2_basic8g.asp?filename=example_icons.xml and this group and I'm using various explantions and code from http://econym.org.uk/gmap/basic16.htm and to call the marker colour from my mysql databse. I've checked the xml is outputting the contents of the database - and all is well, but the icon isn't changing. I don't get where I am going wrong. Could someone very kindly help me out? TIA // Create our colored marker icons var gicons=[]; gicons["red"] = new GIcon("mapicons/marker_red.png"); gicons["blue"] = new GIcon("mapicons/marker_blue.png"); function searchLocationsNear(center) { var radius = document.getElementById('radiusSelect').value; var searchUrl = 'phpsqlsearch_genxml.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius; GDownloadUrl(searchUrl, function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName ('marker'); map.clearOverlays(); var sidebar = document.getElementById('sidebar'); sidebar.innerHTML = ''; if (markers.length == 0) { sidebar.innerHTML = 'No results found. Please try a bigger search distance, a postcode or a larger town'; map.setCenter(new GLatLng(54.9, -4.1), 5); return; } var bounds = new GLatLngBounds(); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute('name'); var address = markers[i].getAttribute('address'); var town = markers[i].getAttribute('town'); var county = markers[i].getAttribute('county'); var postcode = markers[i].getAttribute('postcode'); var telephone = markers[i].getAttribute('telephone'); var icon = markers[i].getAttribute("icon"); var url = markers[i].getAttribute('url'); var distance = parseFloat(markers[i].getAttribute ('distance')); var point = new GLatLng(parseFloat(markers[i].getAttribute ('lat')), parseFloat(markers[i].getAttribute ('lng'))); var marker = createMarker(point, name, address, town, county, postcode, telephone, url, icon); map.addOverlay(marker); var sidebarEntry = createSidebarEntry(marker, name, address, town, county, postcode, telephone, distance); sidebar.appendChild(sidebarEntry); bounds.extend(point); } map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel (bounds)); }); } function createMarker(point, name, address, town, county, postcode, telephone, url, distance, icon) { var marker = new GMarker(point, gicons[icon]); var html = '<b>'+ name + '</b><br>' + address + ', '+ town + '<br>' + telephone + '<br>' + '<a href=' + url + ' target ="_blank"> '+ url +'</a>'; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
