PHP and Web 2.0 |
|
2024-11-26 |
|
|
17 |
|
|
There are actually 4 different APIs. Actionscript-Flash, Flex-Flash,
Javascript controlling a Flash map, and Javascript controlling an AJAX/DHTML map.
I know nothing about Actionscript, nor Flex. Sorry.
Simple Embedded Flash map
<script type="text/javascript"
src="http://api.maps.yahoo.com/v3.0/fl/javascript/apiloader.js?appid=rlerdorf">
</script>
<div id="mapContainer" style="height: 400px; width: 930px;"></div>
<script type="text/javascript">
var mymap = new Map("mapContainer","rlerdorf","Bangalore",10,MapViews.HYBRID);
mymap.addTool(new PanTool(), true);
mymap.addWidget(new SatelliteControlWidget());
mymap.addWidget(new NavigatorWidget());
</script>
Output
It's actually a little bit disappointing how simple it is. We don't even need PHP here.
Of course, chances are you are going to put things onto the map, in which case you are likely to need
PHP to fetch data from a backend to plot.
Simple Embedded DHTML map
<script type="text/javascript"
src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=rlerdorf">
</script>
<div id="jsmapContainer" style="height: 400px; width: 930px;"></div>
<script type="text/javascript">
var jsmap = new YMap(document.getElementById('jsmapContainer'));
jsmap.addTypeControl();
jsmap.addZoomLong();
jsmap.setMapType('YAHOO_SAT');
jsmap.drawZoomAndCenter("Bangalore", 13);
</script>
Output