"; //echo "var erzeuger = [{'name':'Reitter Johann', 'lat':48.0807886, 'lng': 14.2992791}];"; $outp="var erzeuger = ["; $sqls = (string) "SELECT Name, Adresse, PLZ, Ort,lat, lng,Produkte FROM Erzeuger;"; if($Erg=mysql_db_query($dbName, $sqls, $con)) { $zl = mysql_num_rows($Erg); // speichert anzahl der zeilen for($n=0; $n < $zl;$n++) { $d1 = array("" , "", "", "","" , "", ""); $d2 = array("ä" , "ö", "ü", "ß","Ä" , "Ö", "Ü"); $name=mysql_result($Erg,$n,0); $adresse=mysql_result($Erg,$n,1); $plz=mysql_result($Erg,$n,2); $ort=mysql_result($Erg,$n,3); $lat=mysql_result($Erg,$n,4); $lng=mysql_result($Erg,$n,5); $produkte=mysql_result($Erg,$n,6); $name = str_replace($d1, $d2, $name); $adresse = str_replace($d1, $d2, $adresse); $ort = str_replace($d1, $d2, $ort); $produkte=str_replace($d1, $d2, $produkte); $erzlink=strtolower($name); $pos=strpos($name, " "); if ($pos!=false) $erzlink=substr($erzlink,0,$pos); $d1 = array("" , "", "", ""); $d2 = array("a" , "o", "u", "s"); $erzlink = str_replace($d1, $d2, $erzlink); $d1 = array("ä" , "ö", "ü", "ß"); $d2 = array("a" , "o", "u", "s"); $erzlink = str_replace($d1, $d2, $erzlink); $link= "\mehr Infos\"; //Erzeuger if($lat&&$lng!=NULL) $outp.="{'name':'".$name."\ ".$adresse."\".$plz." ".$ort."\".$produkte."\".$link."','lat':".$lat.",'lng':".$lng."},"; } } $outp = substr($outp, 0,strlen($outp)-1); $outp.="];"; echo $outp; //echo "var erzeuger = [{'name':'Reitter Johann', 'lat':48.0807886, 'lng': 14.2992791}];"; echo " // create marker for Erzeuger with given index function createMarker(index) { var point = new GLatLng(erzeuger[index].lat, erzeuger[index].lng); var marker = new GMarker(point); GEvent.addListener(marker, \"click\", function() { marker.openInfoWindowHtml(erzeuger[index].name); }); return marker; } // initialize map with Erzeuger function initialize() { if (!GBrowserIsCompatible()) return; // some sanity checks var nrErz = erzeuger.length; if (nrErz==0) return; // create bounding rect for Erzeuger var erzBounds = new GLatLngBounds(new GLatLng(erzeuger[0].lat, erzeuger[0].lng)); for (var i=1; i zoomMin+1) { while (zoomMax > zoomMin && map.getBounds().containsBounds(erzBounds)) { zoomMin = map.getZoom(); var zoomNext = Math.ceil((zoomMax+zoomMin)/2); // alert(\"zoomMin=\"+zoomMin+\", zoomMax=\"+zoomMax+\", zoomNext=\"+zoomNext); map.setZoom(zoomNext); } while (zoomMax > zoomMin && !map.getBounds().containsBounds(erzBounds)) { zoomMax = map.getZoom(); var zoomNext = Math.floor((zoomMax+zoomMin)/2); // alert(\"zoomMin=\"+zoomMin+\", zoomMax=\"+zoomMax+\", zoomNext=\"+zoomNext); map.setZoom(zoomNext); } } // alert('zoom level: '+ map.getZoom()); //alert(\"nrErz=\"+nrErz); //alert(\"sw-lat=\"+southWest.lat()); // add marker for each Erzeuger for (i = 0; i < nrErz; i++) { //alert(\"erz-lat=\"+erzLat[i]+\",\"+erzNamen[i]); map.addOverlay(createMarker(i)); } map.setMapType(G_NORMAL_MAP); } "; ?>