questo è parte del codice , quello che mi intaressa
class ComponenteViewResult extends JView
{
protected $lat = null;
protected $lng = null;
function display($tpl = null)
{
$this->lat = "00.000000";
$this->lng = "00.000000";
parent::display($tpl);
}
}
$document->addScriptDeclaration("
function load() {
var map = new google.maps.Map(document.getElementById(\"map\"), {
center: new google.maps.LatLng( $this->lat , $this->lng ), <<<<<<<< qui inserisco le mie due variabili <<<<<<<<<
zoom: 7,
mapTypeId: 'roadmap'
});
var infoWindow = new google.maps.InfoWindow;
// Change this depending on the name of your PHP file
downloadUrl(\"http://www.sito.it/cartella/maps.php\", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagNam e(\"marker\");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute(\"name\");
var address = markers[i].getAttribute(\"address\");
var type = markers[i].getAttribute(\"type\");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute(\"lat\")),
parseFloat(markers[i].getAttribute(\"lng\")));
var html = \"\" + name + \" [br /]\" + address;
var icon = customIcons[type] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function doNothing() {}
");