Posted: Thu Jul 20, 2006 5:06 pm
I already did this, even with the whole command and it looked exactly like it should do. Any other idea, what happens?
User and developer community
https://board.s9y.org/
Code: Select all
function load() {ldelim}
if (GBrowserIsCompatible()) {ldelim}
var valstring = "{$entry.properties.ep_googlemapvals}";
var vals = valstring.split(",");
var map = new GMap2(document.getElementById("map{$entry.id}"));
alert('map.setCenter(new GLatLng('+vals[0]+', '+vals[1]+'), '+vals[2]+');');
map.setCenter(new GLatLng(vals[0], vals[1]), vals[2]);
{$entry.properties.ep_googlemappoints}
{rdelim}
{rdelim}Code: Select all
var valstring = "60.18122,24.88403,15";
var vals = valstring.split(",");
var map = new GMap2(document.getElementById("map14"));
alert('map.setCenter(new GLatLng('+vals[0]+', '+vals[1]+'), '+vals[2]+');');
map.setCenter(new GLatLng(vals[0], vals[1]), vals[2]);Code: Select all
map.setCenter(new GLatLng(60.18122, 24.88403), 15);Code: Select all
map.setCenter(new GLatLng("'" + vals[0] + "'", "'" + vals[1] + "'"), "'" + vals[2] + "'");
Code: Select all
<div class="serendipity_entry_body">
{$entry.body}
{if $entry.properties.ep_googlemapvals and $entry.properties.ep_googlemappoints and $entry.properties.ep_googlemapwidth and $entry.properties.ep_googlemapheight}
<div id="map{$entry.id}" style="width: {$entry.properties.ep_googlemapwidth}; height: {$entry.properties.ep_googlemapheight};"></div>
<script type="text/javascript">
//<![CDATA[
function load() {ldelim}
if (GBrowserIsCompatible()) {ldelim}
var valstring = "{$entry.properties.ep_googlemapvals}";
var vals = valstring.split(",");
var map = new GMap2(document.getElementById("map{$entry.id}"));
map.setCenter(new GLatLng(parseFloat(vals[0]), parseFloat(vals[1])), parseFloat(vals[2]));
{$entry.properties.ep_googlemappoints}
{rdelim}
{rdelim}
//]]>
</script>
{/if}
{if $entry.properties.ep_belowgooglemap}
{$entry.properties.ep_belowgooglemap}
{/if}
</div>Code: Select all
<div class="serendipity_entry_body">
{$entry.body} //######FOLLOWING IS NEW ####
{if $entry.properties.ep_googlemap}
<div id="map{$entry.id}" style="width: 600px; height: 400px"></div>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {ldelim}
gmap = new GMap2(document.getElementById("map{$entry.id}")); // create map
_mSvgEnabled = true; _mSvgForced = true;
gmap.addControl(new GLargeMapControl());
gmap.setCenter(new GLatLng(0,0),0,G_HYBRID_MAP);
gmap.addControl(new GScaleControl());
gmap.addControl(new GMapTypeControl());
// track 1 segment 1:
pts1_1 = new Array();
GDownloadUrl("{$entry.properties.ep_googlemap}", function(data, responseCode) {ldelim}
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("trkpt");
var bounds= new GLatLngBounds();
for (var i = 0; i < markers.length; i++) {ldelim}
pts1_1.push(new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lon"))));
bounds.extend(pts1_1[i]);
{rdelim}
gmap.setZoom(gmap.getBoundsZoomLevel(bounds));
gmap.setCenter(bounds.getCenter());
gmap.addOverlay(new GPolyline(pts1_1,"#E600E6",3,0.8));
{rdelim});
{rdelim}
//]]>
</script>
{/if}
//######PREVIOUS IS NEW#######
</div>