Hallo Leute,
ich bin seit Stunden damit beschäftigt benutzerdefinierte Felder in ein Google Maps Plugin für die Koordinaten einzugeben. Ich habe schon mehrere Sachen versucht, bekomme es aber irgendwie nicht hin.
Könnte mir jemand bitte damit helfen die beiden Variablen an der Stelle von $lat und $lng in diese Funktion einzugliedern?
PHP
$longitude = get_post_meta($post->ID, "Longitude", true);
$latitude= get_post_meta($post->ID, "Latitude", true);
Die Ausgabe der Map schaut so aus:
PHP
function SGMprintmap($lat, $lng, $zoom, $type, $content, $directionsto) {
$SGMoptions = get_option('SGMoptions'); // get options defined in admin page
if (!$lat) {$lat = '0';}
if (!$lng) {$lng = '0';}
if (!$zoom) {$zoom = $SGMoptions['zoom'];} // 1-19
if (!$type) {$type = $SGMoptions['type'];} // ROADMAP, SATELLITE, HYBRID, TERRAIN
if (!$content) {$content = $SGMoptions['content'];}
$content = str_replace('<', '<', $content);
$content = str_replace('>', '>', $content);
$content = mysql_escape_string($content);
if ($directionsto) { $directionsForm = "<form method=\"get\" action=\"http://maps.google.com/maps\"><input type=\"hidden\" name=\"daddr\" value=\"".$directionsto."\" /><input type=\"text\" class=\"text\" name=\"saddr\" /><input type=\"submit\" class=\"submit\" value=\"Directions\" /></form>"; }
return "
<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>
<script type='text/javascript'>
function makeMap() {
var latlng = new google.maps.LatLng(".$lat.", ".$lng.")
var myOptions = {
zoom: ".$zoom.",
center: latlng,
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
mapTypeId: google.maps.MapTypeId.".$type."
};
var map = new google.maps.Map(document.getElementById('SGM'), myOptions);
var contentString = '<div class=\"infoWindow\">".$content.$directionsForm."</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: ''
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
window.onload = makeMap;
</script>
<div id='SGM'></div>
";
}
Alles anzeigen
Über Hilfe würde ich mich freuen!
Gute Grüße