Help with simple PHP problem (1 post)

  1. bndooley
    Posted 9 years ago #

    I'm trying to insert a link into the write page on geocoder, so that my users can get coordinates for their address more easily. I thought it would be simple, but I can't seem to figure it out. Sadly, my PHP knowledge is extremely basic. If anyone can help me, I would really appreciate it.

    Here's the code:

    //* Displays the Geo interface on the post editing form
    * Long description for the Function.
    * @param $content Description
    global $post_ID;

    $geolocations = get_settings('geo_locations');

    $output = '<fieldset id="postexcerpt" class="dbx-box"><h3 class="dbx-handle">' . __('Location', 'Geo') . '</h3><div class="dbx-content">';

    list($lat, $lon) = split(',', get_post_meta($post_ID, '_geo_location', true));
    $output .= '<label for="geo_lat">' . __('Latitude:', 'Geo') . ' <input size="10" type="text" value="' . $lat .'" name="geo_lat" id="geo_lat" /></label>   ';
    $output .= '<label for="geo_lon">' . __('Longitude:', 'Geo') . ' <input size="10" type="text" value="' . $lon .'" name="geo_lon" id="geo_lon" /></label>   ';

    $output .= '<label for="geo_select">' . __('Preset:', 'Geo') . ' <select id="geo_select" onchange="geo_choosegeo(this);"><option value="">--choose one--</option>';
    foreach($geolocations as $geolocation => $coords)
    $output .= "<option value=\"$coords\"";
    if($coords == "{$lat},{$lon}") $output .= ' selected="selected"';
    $output .= ">{$geolocation}</option>\n";
    $output .= '</select></label>';
    $output .= '</div></fieldset>';
    $content .= '<div>';
    echo 'Lookup latitude and longitude for your address.';
    $content .= '</div>';

    return preg_replace('#(<div.*?id="advancedstuff".*?'.'>)#ims', '\\1' . $output, $content, 1);

    function admin_head($not_used)

    all I want to do is add a link to geocoder.us next to the left most box, with the text "find your coordinates". I figured echo and some html would do it, but no luck.

    Thanks in advance for your time.


Topic Closed

This topic has been closed to new replies.

About this Topic