Caspio - now you can

Map Mashup Instructions (Version 3)

New in This Version:

Step 1: Get Your API Key

Decide if you want Yahoo! Maps or Google Maps. Yahoo! Maps tend to be more forgiving with incomplete addresses. Both Google and Yahoo! require that you register your domain name and get your site-specific key. Get your free key from the appropriate site:

Step 2: Modify Body Tag

Modify your body tag in your page:

<body onLoad="loadMap(mapType,mapWidth,mapHeight)">

If your body tag contains other parameters, simply add the onLoad event shown above to the existing tag. If you already have an onLoad event in your body tag, then add a semicolon inside double quotes and append our function to the existing onLoad event:

onLoad="function1;function2; loadMap(mapType,mapWidth,mapHeight)"

Step 3: Place Map on Your Results Page

In Caspio Bridge DataPage wizard, go to where Results Page fields are configured and add an HTML Block as the last element. Paste the following code inside the HTML Block:

<a href="#" id="cbMapPtr" onclick="showAddress('[@field:Addr]',[@field:id_location],1,7); return false;">Show on map</a>
<div id="mapType" style="display:none">G</div>
<div id="mapWidth" style="display:none">1000</div>
<div id="mapHeight" style="display:none">800</div>
<span id="mapIcon" style="display:none">3</span>
<div id="plotMulti" style="display:none">Y</div>
<tt style="display:none">[@field:Addr]</tt>
<div id="iconDesc[@field:id_location]" style="display:none">[@field:Description]</div>
<div id="home_position" style="display:none">CA</div>

Complete the following:

Icon 1 = 1   Icon 2 = 2   Icon 3 =3   Icon 4 = 4   Icon 5 = 5
Icon 6 = 6   Icon 7 = 7   Icon 8 = 8   Icon 9 = 9   Icon 10 = 10

Step 4: Place Map on Your Details Page

This is an optional step. If you do not have a details page, skip this step and go to Step 5.

On your Results Page, add an HTML Block as the last element and paste the following code inside the HTML Block:

<div id="dp" style="display:none">true</div>
<div id="mapType" style="display:none">G</div>
<div id="mapWidth" style="display:none">500</div>
<div id="mapHeight" style="display:none">500</div>
<span id="mapIcon" style="display:none">3</span>
<div id="locAddress" style="display:none">[@field:Addr]</div>
<div id="idAddress" style="display:none">[@field:id_location]</div>
<div id="iconDesc[@field:id_location]" style="display:none">[@field:Description]</div>

See Step 3 for the explanation and options for the parameters that must be customized in this code.

Step 5: Add JS Include Files and Specify Map Placement

You must add two JavaScript code segments to your web page. Both of these code segments must be placed after the Caspio Bridge DataPage deploy code.

The first segment is different for Google and Yahoo! maps, so select the one for your map choice:

Replace YOURKEYHERE with your API key from Step 1.

Next, place the following code in your web page somewhere after the code above:

<script type="text/javascript" src="http://bridge.caspio.net/scripts/caspio-mashups.js"></script>

By default, the map will display right above your DataPage. If you want to place your map in a different area of your page, place the following code there:

<div id="map"></div>

Any question or problem? Discuss it on the Caspio user community forums.