Help with Google Maps

24 posts by 9 authors in: Forums > CMS Builder
Last Post: January 20, 2010   (RSS)

By ross - March 5, 2009

Hi John

I think we are getting mixed up when we say view source :).

If you are viewing the source on the actual page, you won't see the php code. If you do, something isn't working quite right.

Would you mind posting me a copy of your template page (The one where you have your map code on) and a copy of the section schema (you'll find that in your /data/schema folder. Probably called listings.ini.php or something similar).

With that, I can run some tests internally for you :). Another option would be to email FTP details to your server. You can fill out a support request for that here:

https://www.interactivetools.com/support/email_support.cgi

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [Jake] Help with Google Maps

By jghoward - August 28, 2009 - edited: August 28, 2009

I'm so glad this tutorial is here. Before I get started, can you tell me if the instructions are the same if I want to show a map for just one record on a details viewer page?

UPDATE:
Awaiting your answer, but in the meantime I've made some progress.

Instead of the list code, I generated the header for the detail page.

Then, to center my map on the same point for which my record needs a marker, I used this code:

<?php foreach ($listingsRecords as $record): ?>


map.setCenter(new GLatLng(<?php echo $record['latitude'] ?>,<?php echo $record['longitude'] ?>), 13);
var point = new GLatLng(<?php echo $record['latitude'] ?>,<?php echo $record['longitude'] ?>);
var marker = createMarker(point,'<?php echo htmlspecialchars($record['street_address'], ENT_QUOTES) ?>, <?php echo htmlspecialchars($record['city'], ENT_QUOTES) ?>')
map.addOverlay(marker);

<?php endforeach; ?>

}

Okay, so my map is working when I load record number from end of url i.e. map.php?address-field-1
Can you tell me how to call the iframe from listingsDetail.php in a way that dynamically loads the correct map.

Will this approach work? Is there a better way?
Why do I need the iframe? Can't I just load the map on the same listingsDetail.php?address-field-1 page?

Re: [jghoward] Help with Google Maps

By Chris - September 3, 2009 - edited: September 3, 2009

Hi jghoward,


Okay, so my map is working when I load record number from end of url i.e. map.php?address-field-1
Can you tell me how to call the iframe from listingsDetail.php in a way that dynamically loads the correct map.


You'll want to do something like this, but change $listingsRecord to the name of the record variable if it's different:

<iframe src="/path/to/map.php?<?php echo $listingsRecord['num'] ?>" width="550" height="350"></iframe>


Will this approach work? Is there a better way?
Why do I need the iframe? Can't I just load the map on the same listingsDetail.php?address-field-1 page?


Yes, it will work. There's really nothing wrong with this approach.

More recent versions of the Google Map API do away with the <iframe> in favour of a <div>. If you're interested in that, I've attached a sample listing page (for multiple records) which uses the V3 API! :D

I hope this helps! Please let us know if you have any questions or comments.
All the best,
Chris
Attachments:

listingsmap.php 3K