The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] PHP Syntax question (5 posts)

  1. mariostella
    Posted 5 years ago #

    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??

  2. Dylan Kuhn
    Posted 5 years ago #

    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.

  3. mariostella
    Posted 5 years ago #

    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

  4. Dylan Kuhn
    Posted 5 years ago #

    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.

  5. mariostella
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic