function init(){
parent::init();
//The Javascript is required in the templates
//Requirements::javascript("http://maps.google.com/maps/api/js?sensor=false");
//Requirements::javascript("mysite/javascript/gmap.js");
Requirements::javascriptTemplate("mysite/javascript/gmap.js",
array(
"gmap_lat" => $this->Latitude,
"gmap_long" => $this->Longitude,
"gmap_zoom" => $this->Zoom,
"gmap_marker" => $this->Marker,
"gmap_info" => $this->Info,
"gmap_marker_title" => $this->MarkerTitle,
"gmap_info_window" => $this->InfoWindow
));
}
gmap.js:
jQuery(document).ready(function(){
var latlng = new google.maps.LatLng(gmap_lat, gmap_long);
var myOptions = {
zoom: gmap_zoom,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
if(gmap_marker == true){
var map_marker = new google.maps.Marker({
position: latlng,
map: map,
animation: google.maps.Animation.DROP,
title: gmap_marker_title
});
}
if(gmap_info == true){
var contentString = gmap_info_window;
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(map_marker, 'click', function() {
infowindow.open(map,map_marker);
});
}
});
When viewing page source, no variables are being substituted and I get javascript errors at the first instance of a variable in firebug.
TIA!