Re: [sangiro] Profile Location
Your Code:
<!--- Map Start --->
<div align="center">
<div id="map2" style="width: 300px; height: 150px; border: solid 1px; #DDD;"></div>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA_-RD-O7nooUyw7-e4ic3ExQQqA5PaaIckF-UfWcKOJB1qhCgBhSPg0b_ntoJfbAHA55A4NBCrDp_vA" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
// define the icons
var fillFields = false;
var smallIcon = new GIcon();
smallIcon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
smallIcon.iconSize = new GSize(12, 20);
smallIcon.shadowSize = new GSize(22, 20);
smallIcon.iconAnchor = new GPoint(6, 20);
smallIcon.infoWindowAnchor = new GPoint(5, 1);
function mapload() {
// Make the map and add controls
var map = new GMap(document.getElementById("map2"));
GEvent.addListener(map, "moveend", function() {
var center = map.getCenterLatLng();
map.clearOverlays();
createMarker(map, new GPoint(center.x, center.y), "", smallIcon, "", 1)
if( fillFields ) {
var lat=Math.round(center.y*100000)/100000;
var lon=Math.round(center.x*100000)/100000;
document.object_attributes.elements['user_latitude'].value = lat;
document.object_attributes.elements['user_longitude'].value = lon;
}
else { fillFields = true; }
//var latLngStr = '(' + center.y + ', ' + center.x + ')'; //DEBUG
//document.getElementById("message").innerHTML = latLngStr; //DEBUG
});
map.setMapType(G_MAP_TYPE);
map.addControl(new GMapTypeControl());
map.addControl(new GSmallMapControl());
map.centerAndZoom(new GPoint(-96.5662, 39.1782), 15);
}
// Creates a marker and a listener so that the
// info window pops up when you click the marker
function createMarker(map, point, label, icon, hovertext, isopen) {
if (icon) {
var marker = new GMarker(point, icon);
}
else {
var marker = new GMarker(point);
}
map.addOverlay(marker);
}
//]]>
</script>
<!--- Map End --->
Change this:
createMarker(map, new GPoint(center.x, center.y), "", smallIcon, "", 1)
To this:
createMarker(map, new GPoint($variable_long, $variable_lat), "", smallIcon, "", 1)
Why you gotta blame google for your inadequacies as a programmer? ;-) ;-)