Reputation: 1295
I have tried to find the link or document to know how to use google map for my site. I am using php. I need code for this. Though I tried a lot to find, may be the way I tried was not correct. Can anybody suggest me the link where I can find the code for google map use.
Thanks in advance.........
Upvotes: 1
Views: 4648
Reputation: 4730
If you're using PHP, you can definitely benefit from using a class like the new PHPGoogleMapAPI class - it's just been updated as well to use V3 of the Google Maps JS APIs.
Upvotes: 0
Reputation: 19445
Most of the google api (and the most of others web-api aswell) are handled better by javascript or flex instead of php
I suggest you to focus on js then :)
Upvotes: 0
Reputation: 42522
Hello world for Google Maps (from the API reference):
<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true_or_false"
type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.setUIToDefault();
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</body>
</html>
So you can stick this straight into a PHP file to get started. Once you have that working you can start adding your server side content to the generated file or maybe server up some XML from a separate PHP file to populate the map.
There are a whole lot of great examples here:
http://code.google.com/apis/maps/documentation/examples/index.html
Upvotes: 5