Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Google Maps

 

 


edandrea
User

Jul 17, 2008, 11:54 AM

Post #1 of 10 (2471 views)
Shortcut
Google Maps Can't Post

Hi

Working with Google Maps. I have worked the .xml to output to my featured listings page and shows all properties on a map very well. For the detail page I have a map but allways shows the first record on the map only. How can I get it to show specific data for specific file?

Here is my .xml code:

<?php header('Content-type: application/xml; charset=utf-8'); ?><?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>

<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
require_once "/home/content/s/m/o/smoaklandco/html/cmsAdmin/lib/viewer_functions.php";

list($customRecords, $customDetails) = getRecords(array(
'tableName' => 'custom',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$customRecord = $customRecords[0]; // get first record

?>



<markers>
<?php foreach ($customRecords as $customRecord): ?>
<marker lat="<?php echo $customRecord['lat'] ?>" lng="<?php echo $customRecord['long'] ?>" />
<?php endforeach; ?>
</markers>

.xml files:

www.smoaklandco.com/location_detail.xml.php?4

www.smoaklandco.com/location_detail.xml.php?5

www.smoaklandco.com/location_detail.xml.php?6



I have tried adjusting the code on the .xml, can get it to show 1 marker on a map but only the first record.



http://smoaklandco.com/ds_detail.php?4



I tried deleting the 'where' and 'limit' and also $customRecord = $customRecords[0]; // get first record but only show first record.



Hope you can help???


(This post was edited by edandrea on Jul 18, 2008, 10:36 AM)


Dave
Staff / Moderator


Jul 18, 2008, 2:43 PM

Post #2 of 10 (2360 views)
Shortcut
Re: [edandrea] Google Maps [In reply to] Can't Post

Hi edandrea,

If you want it to show all listings you need to remove: where, limit, and $customRecord = ....

If you want it to only show featured listings you'd re-add something like this:

'where' => "featured = "1"',

Also, if you always want it to show all the featured listings and not just a specific listing you don't need the number (?1) after the xml url.

Do you still only get 1 result after you do that?

Let me know what happens after you remove those 3 things.

Dave Edis - Senior Developer
interactivetools.com


edandrea
User

Jul 21, 2008, 7:55 AM

Post #3 of 10 (2338 views)
Shortcut
Re: [Dave] Google Maps [In reply to] Can't Post

Hi Dave and thanks for your reply,

1. I have allready created a map showing all featured listings and shows great, www.smoaklandco.com/ds_featured.php.

2. When a user clicks on a featured listing only one marker shows.

3. I had allready attempted to remove the where, limit and custom but all markers show. When I added the 'where' =>"feature="(1)"' it didnt work and I also tried 'featured="(1)"' along with 'num = "(1)"'.

4. The way, I think you have it but I could be wrong, seems like it is only manually generating a specific data, is the way you have it coming up dynamically because that is what I think I need.

5. my .xml.php files display the correct single marker if I type in the specific url www.smoaklandco.com/location_detail.xml.php?4 or 5 or 6.....



I appologize for any confusion, but I sure appreciate any help you offer



Regards Emil


Dave
Staff / Moderator


Jul 21, 2008, 11:03 AM

Post #4 of 10 (2308 views)
Shortcut
Re: [edandrea] Google Maps [In reply to] Can't Post

Hi Emil,

You need to add the record number to the url that google maps downloads. Can you add it to this line:

GDownloadUrl("location_detail.xml.php", function(data, responseCode) {

Maybe something like this (your $variable name might be different):

GDownloadUrl("location_detail.xml.php?<?php echo $record['num'] ?>", function(data, responseCode) {

Let me know if that helps!

Dave Edis - Senior Developer
interactivetools.com


edandrea
User

Jul 21, 2008, 11:36 AM

Post #5 of 10 (2297 views)
Shortcut
Re: [Dave] Google Maps [In reply to] Can't Post

Thank you.....!!!!!



That did the trick. I have a problem with my record numbers not refreshing on the featured listings page. If one record is deleted it allways starts with the next number. So if record # 3 is deleted it starts at #4. Is there a way to have it show #1?


Dave
Staff / Moderator


Jul 22, 2008, 9:36 AM

Post #6 of 10 (2274 views)
Shortcut
Re: [edandrea] Google Maps [In reply to] Can't Post

When you say #1 do you mean record number 1? If so you could use this:

'where' => "num = '1'",

Dave Edis - Senior Developer
interactivetools.com


(This post was edited by Dave on Jul 22, 2008, 9:36 AM)


edandrea
User

Jul 22, 2008, 12:01 PM

Post #7 of 10 (2268 views)
Shortcut
Re: [Dave] Google Maps [In reply to] Can't Post

That just takes away all my listings because the original listing (record 1) was deleted and replaced by what is now record number 4.



You see, I had started off with 3 listings as a test ( #1, 2, 3). Now my client added listing number 4,5,6... and so on, so I deleted the origional listings (1,2,3). But the listings now start at # 4 not begin at #1 record number.


Dave
Staff / Moderator


Jul 22, 2008, 3:12 PM

Post #8 of 10 (2263 views)
Shortcut
Re: [edandrea] Google Maps [In reply to] Can't Post

Record number aren't re-used once they are erased. So once you erase record #123 that number won't be used again.

What are you trying to do or how do you want it to work?

Dave Edis - Senior Developer
interactivetools.com


edandrea
User

Jul 22, 2008, 3:39 PM

Post #9 of 10 (2260 views)
Shortcut
Re: [Dave] Google Maps [In reply to] Can't Post

I have a featured listings page at http://smoaklandco.com/ds_featured.php



I have used the record number provided by the system to number each listing. I was thinking that the record numbers would be refreshed some how. If you take a look at the link you would understand.



If you delete the first listing (record 'num" 1), the next listing wil be record "num" 2 which I have displayed on each listing. The number 2 does not change to number 1 after number 1 is deleted, which makes perfect sence to me, the more I think about it I think it cant be done without messing with MYSQL.



What do you think?



Thanks for the reply

Emil


Dave
Staff / Moderator


Jul 23, 2008, 1:42 PM

Post #10 of 10 (2012 views)
Shortcut
Re: [edandrea] Google Maps [In reply to] Can't Post

Yes, MySQL won't re-use record numbers. Do you just need an incrementing number for Google maps in the XML? If so you might be able to use this:

<?php echo @++$counter ?>

like this:

<marker lat="33.038995" lng="-80.555819" num="<?php echo @++$counter ?>" />

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4