Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
I'm trying to get a Google Map into a page, using an address held in a page as the address to be displayed. This is to allow me to have a series of pages for conferences, each showing its location.

Following the solution given in this post (without even changing the styling details yet so it should work!) I've put the following code into my page:

Code: Select all
<cms:google_map
          name='map'
          address="<cms:show conference_location_map_address />"
          width='170'
          height='170'
          zoom='14'
          style='border-radius: 100%'
     />


The map doesn't display; and when I look at the HTML, the content of the actual page generated contains

Code: Select all
function(){
            var map = new google.maps.Map( document.getElementById("map3") );

            display_by_address( ""<cms:show conference_location_map_address />"", 14, "" );

            function display_by_coordinates( latlng, zoom, html ){
                map.setCenter( latlng );
                map.setZoom( zoom );
                mark( latlng, html, 1 );
            }


..so it seems that the content of the editable region is not being pulled in.

I'm probably doing something obvious wrong - but can anyone tell me what it is?
Your javascript is placed inside the template file, or in an external JS file?
Please post template code here so we can diagnose and find the problem.
Image
Here's the template:

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template clonable='1' >
   <cms:editable name='conference_location_name' type='text' />
   <cms:editable name='conference_location_map_address' type='text' />
   <cms:editable name="conference_status" label="Status" desc="Select one from these" opt_values='Forthcoming | Booking Open | Booking Closed | Past' type='radio' />
   <cms:editable name='conference_general_information' type='richtext' />
   <cms:editable name='conference_agenda' type='richtext' />
   <cms:editable name='conference_speakers' type='relation' masterpage='speakers.php' />
   <cms:editable name='conference_presentations' type='relation' masterpage='presentations.php' reverse_has='one'/>
</cms:template>

<cms:embed 'header.inc' />

<cms:if k_is_page >
   <!-- content for individual conference -->
   <h1><cms:show k_page_title /> Conference</h1>
   <div class="row">
      <div class="col-xs-12 col-md-8">
      <h3>Conference Location Maps</h3>
      <p> <cms:show conference_location_name /></p>
      <!-- Include Google Map -->
      <cms:google_map
          name='map'
          address="<cms:show conference_location_map_address />"
          width='170'
          height='170'
          zoom='14'
          style='border-radius: 100%'
      />
      <p> <cms:show conference_general_information /></p>
      </div>
      <div class="col-xs-12 col-md-4">
         <h2>Presentations</h2>
         <cms:related_pages 'conference_presentations'>
              <cms:show k_page_title /><br>
         </cms:related_pages>
         <h2>Speakers</h2>
         <cms:related_pages 'conference_speakers'>
              <cms:show k_page_title /><br>
         </cms:related_pages>
      </div>
   </div>
<cms:else />
   <!-- content for list of conferences-->
   <h1>All Conferences</h1>
   <cms:pages masterpage='conferences.php' >
   <p><a href="<cms:show k_page_link />"><cms:show k_page_title /> Conference</a></p>
   </cms:pages>
</cms:if>
    
<cms:embed 'footer.inc' />
<?php COUCH::invoke(); ?>


I'm not actually putting the Javascript anywhere - it's generated by the cms:google_map tag.

The header.inc file includes the <head> and the opening <body> tag, as well as the menu system (but no javascript other than a helper for older IEs) , and the footer.inc pulls in footer information and closes the <body>.
Could you do a cms:dump right before the Google Map and verify that the address has been set?

Also, did you set your key in config.php? (I don't think that's the issue, but just making sure).
Great suggestion - and it wasn't set!

That shifts the issue to finding out how I managed to unset it, but that's a probably a good deal easier! Thanks.
5 posts Page 1 of 1