On Oct 26, 2:04 am, Nick Aron <[email protected]> wrote:
> Hello All,
>
> I'm looking for some Google Maps guidance.
>
> I have a search results page written in PHP, receiving results from
> MySQL. Each result has an address and there is a instance of Google
> Maps on the page.
>
> I originally had someone else help me with the implementation of the
> maps. He made it so that the actual map javascript file was a php
> extension (instead of .js) so that he could use php to read from the
> session and basically add a "location1 = new Location("address",
> "description");" and repeat for each result.
>
> I believe that it's a very crappy way of loading the map points and
> i'm sure there is a much better way that I can do this directly from
> the results page code through AJAX or something so as the page renders
> each result it adds a marker to the map or maintains all the marker
> data in a variable and loads them all at the same time once the page
> is loaded.
>
> I also would like to take this opportunity to get to know how Google
> Maps works so that I won't be such a novice and be able to understand
> the API so I can use it to make adjustments to the map.
>
> I am fairly proficient in PHP maybe on a scale of 1-10 i'd give myself
> a 7. I have also had to use Prototype to perform AJAX actions either
> on the click of a link or change of a select box. I am not however
> very good with that on a scale of 1-10 I might rate myself a 1 or 2
> since I got an example from the net and implemented it to my needs and
> it's worked perfectly and has not required that I learn more about
> prototype functionality.
>
> Maybe someone can point me in the right direction.
>
> I would like to learn to do the following (hopefully all through AJAX
> without re-loading the page):
>
> Load GoogleMaps
> Add Markers
> Change Marker style / appearance
> Load several instances of GoogleMaps on a page (as an example each
> result would have it's own map)
>
> I truly appreciate any help you guys/gals can provide for me!
>
> Thanks in advance!
>
I can make some suggestions for part of that:
The way I load results via ajax is I have all of my javascript
functions in a js file, and a list of results in the left "results
pane." and when user clicks "next page" I do a prototype Ajax.Updater
to refresh the results pane. I make sure evalScripts is set to
true.
I have a Javascript section in there that calls the javascript
function I have to display new markers. The arguments to the function
are just points with all relevant information encoded/changed into JS
with json_encode.
Now, if you do not have a "results pane" that you need to update, you
can just do an Ajax.Request to retrieve some json encoded points then
get those points and call the appropriate function on the client side.
I think how to change marker images is found in various tutorials/
examples on the web. Also, if you look in the API documentation, it's
there.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---