Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
geo code change marker

 

 


Maurice
User

May 30, 2011, 7:43 AM

Post #1 of 3 (277 views)
Shortcut
geo code change marker Can't Post

I'm trying to change my marker with the geo plugin in but for some reason it not working.


Code
 
<script type="text/javascript">
function initialize() {
var mapCanvasId = 'map_canvas';
var mapOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById(mapCanvasId), mapOptions);
var bounds = new google.maps.LatLngBounds();
var infowindow = new google.maps.InfoWindow();
var image = 'marker.png'();
var Marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image
});
<?php
foreach ($lstAccountsRecords as $record) {
if (!$record['latitude'] || !$record['longitude']) { continue; }
$jsFunctionArgs = "{$record['latitude']}, {$record['longitude']}, {$record['num']}, '" .escapeJs($record['_link']). "'";
print " _geocoder_addMarker($jsFunctionArgs);\n";
}
?>

//
function _geocoder_addMarker(latitude, longitude, recordNum, detailLink) {
var latLng = new google.maps.LatLng(latitude, longitude);
var infowindowEl = document.getElementById('marker_infowindow_' + recordNum);
var marker = new google.maps.Marker({ map: map, position: latLng });
google.maps.event.addListener(marker, 'mouseover', function() {
if (infowindowEl) {
infowindow.setContent(infowindowEl.innerHTML);
infowindow.open(map, marker);
}
else {
window.location = detailLink;
}
});
bounds.extend(latLng);
}

//
map.fitBounds(bounds);
}

</script>


what am i doing wrong???
-------------------------------------------
www.intraserve.nl

Soon! cmsBy.intraserve


Jason
Staff / Moderator


May 30, 2011, 10:12 AM

Post #2 of 3 (270 views)
Shortcut
Re: [Maurice] geo code change marker [In reply to] Can't Post

Hi Maurice,

Markers are actually being added in the addMarker() function, so that's where you need to make the change. For example:


Code
 // 
function _geocoder_addMarker(latitude, longitude, recordNum, detailLink) {
var image = 'marker.png';
var latLng = new google.maps.LatLng(latitude, longitude);
var infowindowEl = document.getElementById('marker_infowindow_' + recordNum);
var marker = new google.maps.Marker({ map: map, position: latLng, icon: image });
google.maps.event.addListener(marker, 'click', function() {
if (infowindowEl) {
infowindow.setContent(infowindowEl.innerHTML);
infowindow.open(map, marker);
}
else {
window.location = detailLink;
}
});
bounds.extend(latLng);
}


Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/ 


Maurice
User

May 30, 2011, 11:21 PM

Post #3 of 3 (263 views)
Shortcut
Re: [Jason] geo code change marker [In reply to] Can't Post

Jason THANK YOU VERY MUTCH !!!!!!!!!!!!!!!!!!!!!!!!

u r the best
-------------------------------------------
www.intraserve.nl

Soon! cmsBy.intraserve