-
Notifications
You must be signed in to change notification settings - Fork 9
/
markers_basics.php
52 lines (41 loc) · 1.42 KB
/
markers_basics.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
// This is for my examples
require( '_system/config.php' );
$relevant_code = array(
'\PHPGoogleMaps\Overlay\Marker',
'\PHPGoogleMaps\Overlay\MarkerDecorator'
);
// Autoload stuff
require( '_system/autoload.php' );
$map = new \PHPGoogleMaps\Map;
$marker1_options = array(
'title' => 'New York, NY',
'content' => '<p><strong>New York, NY info window</strong></p>'
);
$marker1 = \PHPGoogleMaps\Overlay\Marker::createFromLocation( 'New York, NY', $marker1_options );
$marker2_options = array(
'title' => 'San Diego, CA',
'content' => '<p><strong>San Diego, CA info window</strong></p>'
);
$marker2 = \PHPGoogleMaps\Overlay\Marker::createFromPosition( new \PHPGoogleMaps\Core\LatLng( 32.7153292,-117.1572551 ), $marker2_options );
// Add both markers to the map
// We need to be able to remove marker1 so we get a decorator for it
$marker1_map = $map->addObject( $marker1 );
$map->addObject( $marker2 );
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Marker Basics - <?php echo PAGE_TITLE ?></title>
<link rel="stylesheet" type="text/css" href="_css/style.css">
<?php $map->printHeaderJS() ?>
<?php $map->printMapJS() ?>
</head>
<body>
<h1>Marker Basics</h1>
<?php require( '_system/nav.php' ) ?>
<?php $map->printMap() ?>
<a href="#" onclick="<?php echo $marker1_map->getJsVar() ?>.setMap(null); return false;">Hide New York marker</a>
</body>
</html>