@Demmy, sorry if I wasn't clear. I give you an exemple : I wanted my client to be able to change the position of the "coloured pin" on his Google Map.
I added a DB field named "GPS" in my ContactPage.php (ContactPage.ss is the template where I display the map) :
<?php
class PageContact extends Page {
public static $db = array(
'GPS' => 'Text'
);
...
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.GoogleMap', new TextField('GPS', 'Coordonnées GPS (format : 47.338979,1.00158)')); return $fields;
}
And in ContactPage.ss :
<% if GPS %>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(
{$GPS});
var myOptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("GMap"),
myOptions);
var marker = new google.maps.Marker({
position: latlng,
map: map,
title:"$SiteConfig.Title",
visible:true
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="GMap">
</div>
<% end_if %>
The map displayed in the site is centered on the position entered by the client in the CMS.