Ohne viele Worte:
Code:
<?php if ($this->items->getCount()): ?>
<script>
function gmap1_dynmap(gmap1) {
var markers = [];
<?php
foreach($this->items->parseAll($this->getFormat(), $this->view) as $arrItem):
$name = htmlspecialchars($arrItem['text']['name'], ENT_QUOTES);
$url = $arrItem['raw']['url'];
$geolocation = $arrItem['raw']['geolocation'];
$address = preg_replace( "/\r|\n/", "<br>", $arrItem['text']['address']);
$id = $arrItem['raw']['id'];
$info = '<div class="gmap-infobox-tip"></div>';
$info .= '<div class="gmap-infobox-content">';
$info .= '<p class="name">' .$name .'</p>';
$info .= '<p><a target="_blank" href="' .$url .'">' .$url .'</a></p>';
$info .= '<p>' .$address .'</p>';
$info .= '</div>';
?>
// Create Marker
var gmap1_<?php echo $id; ?>_marker = new google.maps.Marker({
position: new google.maps.LatLng(<?php echo $geolocation; ?>),
map: gmap1,
title:"<?php echo $name; ?>",
icon: new google.maps.MarkerImage(
'files/blogger.png',
new google.maps.Size(20, 20),
new google.maps.Point(0,0),
new google.maps.Point(5,21)
),
});
markers.push(gmap1_<?php echo $id; ?>_marker);
// Create InfoBox
var gmap1_<?php echo $id; ?>_infobox1 = new InfoBox({
content: '<?php echo $info; ?>',
disableAutoPan: false,
maxWidth: 150,
boxClass: 'gmap-infobox',
pixelOffset: new google.maps.Size(-75, -5),
zIndex: null,
closeBoxMargin: '18px 8px 2px 2px',
closeBoxURL: 'http://www.google.com/intl/en_us/mapfiles/close.gif'
});
// Create Event Listener
google.maps.event.addListener(gmap1_<?php echo $id; ?>_marker, 'click', function() {
gmap1_<?php echo $id; ?>_infobox1.open(gmap1, this);
});
<?php endforeach; ?>
var markerCluster = new MarkerClusterer(gmap1, markers);
}
</script>