Forums

Dynamically-generated google maps (2 posts)

  1. marinas
    Member
    Posted 8 months ago #

    Hi,

    I am writing code that will hopefully become a wordpress plugin in the future.

    I would like to code the following functionality:
    * display of a map with pointers indicating the
    locations of the posts diplayed in a blog page (I have limited the
    visualization to 5 posts per page). I take the locations saved in the post tags. My geocoder works correctly and I get the correct coordinates. I store these coordinates in a array and in a php file.
    The code and the problem is also described here:

    http://stackoverflow.com/questions/7430403/googlemap-and-wordpress-problems-in-creating-markers-dynamically

    but the solutions suggested so far did not work :-(
    Why is javascript not displaying pointers specified in a dynamically
    generated array/file, while it has no problem with a static
    array/file?
    Is it a problem with "timing"? That is, javascript is executed before
    the array is completed created? it should not be so, as i specified
    "onload" ... :-(

  2. marinas
    Member
    Posted 8 months ago #

    Eureka! I did find the solution of my error. Instead of specifying the Javacript code that takes care of the pointers and GoogleMaps in the header, I moved it to the bottom of the index.php. This means that the map data will be processed only when my Geocoder has finished its job and the pointer list/array is complete!

    The interaction between PhP and Javascript was not completely clear to me :-)

    Marina

Reply

You must log in to post.

About this Topic