Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
14 posts Page 2 of 2
ianhaney50 wrote: I can integrate google maps into the front end as before integrated couchcms, I had google maps iframe coding integrated and was working or is this link better: ... google-map

The link you mentioned has this line in JS -
Code: Select all
var uluru = {lat: -25.344, lng: 131.036};

Did you define 2 text regions to store lat/long numbers and did you use them? I would expect to see something like this in your code -
Code: Select all
var uluru = {lat: <cms:get var='my_editable_lat' default='-25.344' />, lng: <cms:get var='my_editable_lng' default='131.036' />};

I think <cms:get /> is somewhat rarely used in the wild, so maybe keep it simple with <cms:show > -
Code: Select all
var uluru = {lat: <cms:show my_editable_lat />, lng: <cms:show my_editable_lng />};

Hope it helps. At least, you will have a map which coordinates can be set/changed via backend.
I have done this

Code: Select all
<cms:editable name='my_editable_lat' type='text'/>
<cms:editable name='my_editable_lng' type='text'/>

Code: Select all
<div id="map"></div>
// Initialize and add the map
function initMap() {
  // The location of Uluru
  //var uluru = {lat: 52.080880, lng: 0.432960};
  var uluru = {lat: <cms:show my_editable_lat />, lng: <cms:show my_editable_lng />};
  // The map, centered at Uluru
  var map = new google.maps.Map(
      document.getElementById('map'), {zoom: 16, center: uluru});
  // The marker, positioned at Uluru
  var marker = new google.maps.Marker({position: uluru, map: map});
    <script async defer

Seems like it's working ok from the backend, why is it things seems so easy when someone else helps, I feel stupid as it seems so simple but does the job 100%
I have another(hopefully little issue), I'll create a new topic for it
If anyone else reads this thread, there is a native Couch Tag http://docs.couchcms.coms/concepts/google-maps.html - <cms:google_map />. It supports following parameters: 'name', 'id', 'address', 'longitude', 'latitude', 'zoom', 'message', 'width', 'height', 'style' - documentation is a bit scarce in relation to currently available parameters but there is nothing you can't grasp from an experiment..
14 posts Page 2 of 2