Obwohl ich einen neuen api key erstellt habe bekomme ich immer diese Nachricht:
Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v2 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: http://code.google.com/apis/maps/documentation/javascript/v2/introduction.html#Obtaining_Key
jetzt wollte ich die extension (mh_branchenbuch/class.tx_mhbranchenbuch_p1.php ) im Bereich googlemap umschreiben (vom Entwickler hab ich ja keine Antwort bekommen...) aber da ich nur den Teil kenne, ist wohl was falsch. Wenn ich das hochlade, erscheint nur ne weisse Seite. Wahrscheinlich eine endlosschleife. Bin halt kein PHP Profi. Ich kopier mal das Original (funktioniert bis auf die Fehlermeldung obne) und das geaenderte auf v3, das leider nicht funktioniert. Vieleicht hat ja ein Profi hier etwas mitleid und stoesst meine Amateurnase auf den wahrscheinlichen Anfaengerfehler:o
Version v2:
function initMap($lat, $lng, $lid = FALSE, $bid = FALSE, $oid = FALSE, $uid = FALSE) {
$template = $this->cObj->getSubpart($this->template,"###MAPCODE###");
$api = $this->map_api;
$output = ''; #init
$markerArray = array(); #init
$wrappedSubpartArray = array(); #init
$WHERE_CLAUSE = ''; #init
if($bid) { $WHERE_CLAUSE .= 'f.`bundesland` = ' . intval($bid); $zoom = $this->map_zoom1; }
if($lid) { $WHERE_CLAUSE .= ' f.`landkreis` = ' . intval($lid); $zoom = $this->map_zoom2; }
if($oid) { $WHERE_CLAUSE .= ' f.`ort` = ' . intval($oid); $zoom = $this->map_zoom3; }
if($uid) { $WHERE_CLAUSE .= ' f.`uid` = ' . intval($uid); $zoom = $this->map_zoom4; }
if($api) {
$sql = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,"
SELECT
f.*,
o.zip AS o_zip,
o.name AS o_city
FROM
`" . $this->dbTable1 . "` f
LEFT JOIN " . $this->dbTable5 . " o ON o.uid = f.ort
LEFT JOIN " . $this->dbTable2 . " k ON k.uid = f.kategorie
WHERE
" . $WHERE_CLAUSE . "
AND
f.`map_lat` != ''
AND
f.`map_lng` != ''
AND
f.`deleted` = 0
AND
f.`hidden` = 0
");
$marker = ''; #init
if($GLOBALS['TYPO3_DB']->sql_num_rows($sql)) {
while($row = mysql_fetch_array($sql)) {
$marker_content = $this->cObj->getTypoLink($row['firma'],$row['link'],'', $this->conf['linkTarget']);
if($row['forename'] != "" && $row['lastname'] != "") {
$marker_content .= '<br />' . $row['forename'] . ' ' . $row['lastname'];
}
$adresse = $row['adresse'];
$adresse = preg_replace('/\r\n|\n|\r/', '<br />', $adresse);
$marker_content .= '<br />' . $adresse;
$zip = $row['zip'] != '' ? $row['zip'] : $row['o_zip'];
$city = $row['city'] != '' ? $row['city'] : $row['o_city'];
$marker_content .= '<br />' . $zip . ' ' . $city;
$marker_content .= '<br /><br />' .$this->cObj->stdWrap($row['telefon'],$this->conf['tel_stdWrap.']);
$marker_content .= '<br />' .$this->cObj->stdWrap($row['fax'],$this->conf['fax_stdWrap.']);
if($this->map_showImage == 1) {
$file = ($row['bild'] == false) ? $this->conf['noImage'] : 'uploads/tx_mhbranchenbuch/'. $row['bild'];
$imgTSConfig = Array();
$imgTSConfig['file'] = $file;
$imgTSConfig['file.']['maxW'] = $this->imgMaxWidth;
$imgTSConfig['file.']['maxH'] = $this->imgMaxHeight;
$imgTSConfig['altText'] = $row['firma'];
$imgTSConfig['titleText'] = $row['firma'];
$imgTSConfig['params'] = $this->imageParams;
if(strlen($row['detail'])>0) {
$marker_content .= '<br /><br />' .$this->pi_linkTP($this->cObj->IMAGE($imgTSConfig),array($this->prefixId.'[detail]'=> $row['uid']),1,$this->single_pid);
} else {
if(isset($row['link'])) {
$marker_content .= '<br /><br />' .$this->cObj->getTypoLink($this->cObj->IMAGE($imgTSConfig),$row['link'],'', $this->conf['linkTarget']);
} else {
$marker_content .= '<br /><br />' .$this->cObj->IMAGE($imgTSConfig);
}
}
}
$marker .= "gmap.addOverlay(createMarker( new GLatLng(" . $row['map_lat'] . "," . $row['map_lng'] . "), '<p class=\"mh_branchenbuch_mapcon\">" . $marker_content . "</p>'));\n";
}
}
$output .= '
<script type="text/javascript">
document.write(\'<sc\'+\'ript src="http://maps.google.com/maps?file=api&v=2&key=' . $api . '" type="text/javascript"></scr\'+\'ipt>\');
function mapload() {
if (GBrowserIsCompatible()) {
var gmap = new GMap2(document.getElementById("mh_branchenbuch_map"), {mapTypes:[G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP]});
gmap.addControl(new GSmallMapControl());
gmap.addControl(new GMapTypeControl());
gmap.setCenter(new GLatLng(' . $lat . ',' . $lng . '),' . $zoom . ');
' . $marker . '
}
}
function createMarker(point, mtext) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml( mtext );
});
return marker;
}
window.setTimeout(mapload,1000);
</script>';
$markerArray['###GENERATED_CODE###'] = $output;
return $this->cObj->substituteMarkerArrayCached($template,$markerArray,array(),$wrappedSubpartArray);
} else {
return 'Error, no API-Key found!';
}
}
und Version V3 (funktioniert leider noch nicht#angry#
function initMap($lat, $lng, $lid = FALSE, $bid = FALSE, $oid = FALSE, $uid = FALSE) {
$template = $this->cObj->getSubpart($this->template,"###MAPCODE###");
$api = $this->map_api;
$output = ''; #init
$markerArray = array(); #init
$wrappedSubpartArray = array(); #init
$WHERE_CLAUSE = ''; #init
if($bid) { $WHERE_CLAUSE .= 'f.`bundesland` = ' . intval($bid); $zoom = $this->map_zoom1; }
if($lid) { $WHERE_CLAUSE .= ' f.`landkreis` = ' . intval($lid); $zoom = $this->map_zoom2; }
if($oid) { $WHERE_CLAUSE .= ' f.`ort` = ' . intval($oid); $zoom = $this->map_zoom3; }
if($uid) { $WHERE_CLAUSE .= ' f.`uid` = ' . intval($uid); $zoom = $this->map_zoom4; }
if($api) {
$sql = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,"
SELECT
f.*,
o.zip AS o_zip,
o.name AS o_city
FROM
`" . $this->dbTable1 . "` f
LEFT JOIN " . $this->dbTable5 . " o ON o.uid = f.ort
LEFT JOIN " . $this->dbTable2 . " k ON k.uid = f.kategorie
WHERE
" . $WHERE_CLAUSE . "
AND
f.`map_lat` != ''
AND
f.`map_lng` != ''
AND
f.`deleted` = 0
AND
f.`hidden` = 0
");
$marker = ''; #init
if($GLOBALS['TYPO3_DB']->sql_num_rows($sql)) {
while($row = mysql_fetch_array($sql)) {
$marker_content = $this->cObj->getTypoLink($row['firma'],$row['link'],'', $this->conf['linkTarget']);
if($row['forename'] != "" && $row['lastname'] != "") {
$marker_content .= '<br />' . $row['forename'] . ' ' . $row['lastname'];
}
$adresse = $row['adresse'];
$adresse = preg_replace('/\r\n|\n|\r/', '<br />', $adresse);
$marker_content .= '<br />' . $adresse;
$zip = $row['zip'] != '' ? $row['zip'] : $row['o_zip'];
$city = $row['city'] != '' ? $row['city'] : $row['o_city'];
$marker_content .= '<br />' . $zip . ' ' . $city;
$marker_content .= '<br /><br />' .$this->cObj->stdWrap($row['telefon'],$this->conf['tel_stdWrap.']);
$marker_content .= '<br />' .$this->cObj->stdWrap($row['fax'],$this->conf['fax_stdWrap.']);
if($this->map_showImage == 1) {
$file = ($row['bild'] == false) ? $this->conf['noImage'] : 'uploads/tx_mhbranchenbuch/'. $row['bild'];
$imgTSConfig = Array();
$imgTSConfig['file'] = $file;
$imgTSConfig['file.']['maxW'] = $this->imgMaxWidth;
$imgTSConfig['file.']['maxH'] = $this->imgMaxHeight;
$imgTSConfig['altText'] = $row['firma'];
$imgTSConfig['titleText'] = $row['firma'];
$imgTSConfig['params'] = $this->imageParams;
if(strlen($row['detail'])>0) {
$marker_content .= '<br /><br />' .$this->pi_linkTP($this->cObj->IMAGE($imgTSConfig),array($this->prefixId.'[detail]'=> $row['uid']),1,$this->single_pid);
} else {
if(isset($row['link'])) {
$marker_content .= '<br /><br />' .$this->cObj->getTypoLink($this->cObj->IMAGE($imgTSConfig),$row['link'],'', $this->conf['linkTarget']);
} else {
$marker_content .= '<br /><br />' .$this->cObj->IMAGE($imgTSConfig);
}
}
}
$marker .= "google.maps.addOverlay(createMarker( new GLatLng(" . $row['map_lat'] . "," . $row['map_lng'] . "), '<p class=\"mh_branchenbuch_mapcon\">" . $marker_content . "</p>'));\n";
}
}
$output .= '
<script type="text/javascript">
document.write(\'<sc\'+\'ript src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></scr\'+\'ipt>\');
function mapload() {
var latlng = new google.maps.LatLng(' .$lat . ',' . $lng . ',' . $marker . ')
var myOptions = {
zoom (' . $zoom . '),
center: latlng
mapTypeId: google.maps.MapTypeId.ROADMAP),
};
map = new google.maps.Map(document.getElementById("mh_branchenbuch_map") myOptions );
}
function createMarker(position, mtext) {
var myLatLng = new google.maps.LatLng(loc['$lat '], loc['$lng']);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
shadow: shadow,
icon: image
});
marker.setMap(map);
google.maps.addListener(marker, "click", function() {
marker.openInfoWindowHtml( mtext );
});
return marker;
}
window.setTimeout(mapload,1000);
</script>';
$markerArray['###GENERATED_CODE###'] = $output;
return $this->cObj->substituteMarkerArrayCached($template,$markerArray,array(),$wrappedSubpartArray);
} else {
return 'Error, no API-Key found!';
}
}