Here are instructions to set up a yahoo map link from your viewlistings file.
Step 1. Create a new extra field that you are going to use for the location. After you have created this write down the id number of this field. It will be listed on the main screen for the extra fields. For this example we will say it is number 4 but it will differ for yours.
Step 2. Go to
http://developer.yahoo.com/maps/ and register for an account.
Step 3. Create a new php file named map.php and include the following code. Change the "your_yahoo_api_id" with your yahoo api id.
HTML Code:
<html>
<head>
<script type="text/javascript" src="http://api.maps.yahoo.com/v2.0/fl/javascript/apiloader.js"></script>
<style type="text/css">
#mapContainer {
height: 600px;
width: 600px;
}
</style>
</head>
<body>
<div id="mapContainer"></div>
<?php
$location=trim($_GET['location']);
?>
<script type="text/javascript">
// Create and display Map object at the address and with zoom level 3
// Include your application ID.
var map = new Map("mapContainer", "your_yahoo_api_id", "<?php echo $location; ?>", 3);
// Make the map draggable
map.addTool( new PanTool(), true );
// Create a POI marker object
marker1 = new CustomPOIMarker( 'LOCATION', '<?php echo $location; ?>', 'This location is approximate.', '0xFF0000', '0xFFFFFF' );
// Add the POI marker to the map and display it
map.addMarkerByAddress( marker1, "<?php echo $location; ?>");
</script>
</body>
</html>
Step 4. Open your viewlistings template file and locate the extra fields section. It will probably look like this:
Code:
{* Extra Fields *}
{foreach from=$extra item=extras}
<tr>
<td><strong>{$extras.title}:</strong></td>
<td>
{if isset($extras.value)}
{foreach key=key item=item from=$extras.value}
{$item}<br />
{/foreach}
{/if}
</td>
</tr>
{/foreach}
{* End Extra Fields *}
Replace it with this:
Code:
{* Extra Fields *}
{foreach from=$extra item=extras}
<tr>
<td class="borderleft"><strong>{$extras.title}:</strong></td>
<td class="borderright">
{if isset($extras.value)}
{foreach key=key item=item from=$extras.value}
{if $extras.fID==4}
<a href="javascript:void(0);" onclick="MM_openBrWindow('http://www.yoursite.com/map.php?location={$item}','contact','width=600,height=600')">{$item}</a>
{else}
{$item}<br />
{/if}
{/foreach}
{/if}
</td>
</tr>
{/foreach}
{* End Extra Fields *}
Change the line {if $extras.fID==4} to include the number from step 1. Finally change yoursite.com to your actual website.