Support » Plugins and Hacks » PHP Syntax question

  • Resolved mariostella


    Quite inexpert on PHP, but I am trying to pull geo-mashup coordinates with a template function. I am just having issues injecting the function with the coordinates. I am using this function:

    <?php $coords = GeoMashup::post_coordinates(); echo GeoMashup::map('map_content=global&remove_geo_mashup_logo=true&radius_mi=10&near_lat=' . $coords['lat'] . '&near_lng=' . $coords['lng'] . '') ?>

    I am guessing I messed up here near_lat=' . $coords['lat'] . ' (and with the immediately following piece of code for lng).

    How can I inject those coordinates in the function??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The syntax looks like it should work to me (you could add a semicolon at the end, and the last . '' isn’t necessary, but these shouldn’t cause errors). I’d have to be able to troubleshoot a bit to tell you for sure what’s wrong.

    Actually I do not get errors, the code just does not get injected with coords, the map displays fine but as if there were no coordinates in the geo mashup code.
    If I change anything in the code above I get errors and the page does not load.

    Maybe I am calling the coordinates wrongly? If you were to do something like this how would you code it? (hint hint! :)))))) )

    Thanks in advance

    It really looks like it should work to me. Maybe make sure the code is inside the loop, as the current_location() returns the coordinates of the current loop post.

    It works indeed, I had a redirection issue with my test page that sent me to a page without a saved map on it…sorry for the useless mess.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP Syntax question’ is closed to new replies.