Inline Map image

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
sulen
Forum Commoner
Posts: 79
Joined: Wed Jul 09, 2003 4:55 pm
Location: los angeles
Contact:

Inline Map image

Post by sulen »

I have a PHP class and method that will take an address as input and strip it down to provide a link to the map of the location on yahoo maps. Now i was wondering if there is any way I can make that image inline so people dont have to actually click on the link to view the map. Let me know if there is a way. Any help will be appreciated. Thanks

Code: Select all

class Map {
    var $addr;
    var $csz;
    var $country;
    var $base_link = "http://maps.yahoo.com/maps_result";
    var $link;
    
    function Map() {
        $this->addr = $_POST['address'];
        $this->csz = $_POST['csz'];
        $this->country = $_POST['country'];
        $this->link = $this->base_link . 
          $this->parseURL(
            array('addr'=>$this->addr,
                  'csz'=>$this->csz,
                  'country'=>$this->country,
                  'new'=>'1')
          );
    }
    
    function parseURL($array) {
        $output = '?';
        $first = true;
        foreach($array as $key => $value) {
            if (!$first) {
                $output .= '&';
            } else {
                $first = false;
            }
            $output .= $key;
            $output .= '=';
            $output .= urlencode($value);
        }
        return $output;
    }
    
function displayLink() {
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Link to the Map</title>
</head><body>
<p>address - <?=$_POST[address]?></p>
<p><a href="<?php echo $this->link; ?>" class="five">Link to the Map</a></p>
</body></html>
<?
}
}
 
$map = new Map;
$map->displayLink();
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

It seems quite hard, but if you can figure out how images MAPDATA is done then sure

Code: Select all

http://image.maps.yahoo.com/mapimage?MAPDATA=FQxgoOd6wXVIvgmdxwt1.N6t4ehttf9DwFBJJtja6k3mgJ5vwfP9b4Njpwa_H_aZHFSbncZX2bKptLeyT6GEL4XfTyIDWTDaro.itA9dZ_TzVYF6T3lDsQqDykpKXlycSEayG8y.HW5sVd7O3ciRm8JxG7iYeQqhKo.t
But before you proceed read carefully
http://help.yahoo.com/help/us/maps/maps-24.html
To me it seems like they are saying a big no for this kind of action.
User avatar
sulen
Forum Commoner
Posts: 79
Joined: Wed Jul 09, 2003 4:55 pm
Location: los angeles
Contact:

Post by sulen »

I know ......... I thought of the same thing but the data passed for MAPdata seems too hard to decipher so was wondering if there was an easier way to do this ........ thanks
Post Reply