mercoledì 20 aprile 2011

JUMI EVENTLIST MAP ELENCO VENUES

 DA AGGIUNGERE NELLA HEAD:

<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

////////////////////////////////////////////////////////////

DA GGIUNGERE NEL TAG BODY

onload="initialize()"

////////////////////////////////////////////////////////////

JUMI:

<script type="text/javascript">
  function initialize() {
    var myLatlng = new google.maps.LatLng(41.86083,12.45849);
    var myOptions = {
      zoom: 4,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
var geocoder = new google.maps.Geocoder();


    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);



<?php

//ABQIAAAAaH4ACtz6HstKXrv9zNFHsxQFgt47foaNXgXPdffZbZtVFssRrhR0GfcxkAQm1ZGY0pXOCVR1yp9qoQ



$db =& JFactory::getDBO();
$queryz = "SELECT * FROM jos_eventlist_venues";

$db->setQuery( $queryz );

$rows = $db->loadObjectList();

foreach($rows as $row): ?>

<?php
$idd=$row->id;
$street = $row->street ;
$city= $row->city;
$country= $row->country;
$venue= $row->venue;
$locdescription= $row->locdescription;
?>






    var contentString<?php echo $idd; ?> = unescape('<div id="content">'+'<div id="siteNotice">'+'</div>'+'<h1 id="firstHeading" class="firstHeading"><?php echo $venue; ?></h1>'+'<div id="bodyContent" style="width: 500px;">'+'<div  style="width: 300px;"><p><?php echo $street." ".$city; ?></p><br><?php echo str_replace("+"," ",urlencode(strip_tags($locdescription))); ?></div></div>'+'</div>');
      
    var infowindow<?php echo $idd; ?> = new google.maps.InfoWindow({
        content: contentString<?php echo $idd; ?>
    });

var address<?php echo $idd; ?>="<?php echo $street." ".$city." ".$country; ?>";
geocoder.geocode( { 'address': address<?php echo $idd; ?>}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var marker<?php echo $idd; ?> = new google.maps.Marker({
            map: map,
            position: results[0].geometry.location
        });
google.maps.event.addListener(marker<?php echo $idd; ?>, 'click', function() {
      infowindow<?php echo $idd; ?>.open(map,marker<?php echo $idd; ?>);
    });
  
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }

});



<?php endforeach;  ?>

}

</script>


<div  style="height: 400px; float: left;">
  <div id="map_canvas" style="height: 400px; float: left;"></div></div>

Nessun commento:

Posta un commento