Load via AJAX

[Open in new Window]

/**
 * Data provider file: data/marker-provider.php
 */
include_once('../../../GoogleMapsPHP/Classes/Core/Bootstrap.php');

$dataProvider = \AdGrafik\GoogleMapsPHP\Utility\ClassUtility::makeInstance('AdGrafik\\GoogleMapsPHP\\PlugInProvider');

$dataProvider->add('Marker', array(
	'position' => '48.6, 16.0',
	'icon' => '../GoogleMapsPHP/Ressources/Public/Icons/Marker/airport.png',
	'shadow' => '../GoogleMapsPHP/Ressources/Public/Icons/Shadow/shadow.png',
	'infoWindow' => array(
		'content' => '<strong>Hello</strong> World!',
		'closeOnClickAgain' => TRUE,
		'keepOpen' => TRUE,
	),
));

$dataProvider->add('Marker', array(
	'position' => array(
		'48.0, 16.0', '48.2, 16.2', '48.4, 16.4', '48.6, 16.6',
		'48.8, 16.4', '49.0, 16.2', '49.2, 16.0', '49.0, 15.8',
		'48.8, 15.6', '48.6, 15.4', '48.4, 15.6', '48.2, 15.8',
	),
	'title' => array(
		'48.0, 16.0', '48.2, 16.2', '48.4, 16.4', '48.6, 16.6',
		'48.8, 16.4', '49.0, 16.2', '49.2, 16.0', '49.0, 15.8',
		'48.8, 15.6', '48.6, 15.4', '48.4, 15.6', '48.2, 15.8',
	),
	'titleOptionSplit' => '*',
	'infoWindow' => array(
		array('closeOnClickAgain' => TRUE, 'content' => '<strong>A</strong>'),
		array('closeOnClickAgain' => TRUE, 'content' => '<strong>B</strong>'),
		array('closeOnClickAgain' => TRUE, 'content' => '<strong>C</strong>'),
	),
	'infoWindowOptionSplit' => '0 || 1 |*| 2 || 0 || 2 |*| 1 || 0',
));

$dataProvider->sendJson();
include_once('../../GoogleMapsPHP/Classes/Core/Bootstrap.php');

$map = new AdGrafik\GoogleMapsPHP\MapBuilder();
$map->setCloseAllInfoWindowsOnMapClick(TRUE);
$map->setCenter('48.608202, 16.373749');
// Add used plug-in resources of data provider.
$map->addPlugInViewResources(array('Marker', 'InfoWindow'));

$map->add('Loader', array(
	'id' => 'loader',
	'url' => 'data/marker-provider.php',
));

echo $map;

Loading the viewport

[Open in new Window]

include_once('../../GoogleMapsPHP/Classes/Core/Bootstrap.php');

$map = \AdGrafik\GoogleMapsPHP\Utility\ClassUtility::makeInstance('AdGrafik\\GoogleMapsPHP\\MapBuilder');
$map->setCloseAllInfoWindowsOnMapClick(TRUE);
$map->setCenter('48.608202, 16.373749');
// Add used plug-in resources of data provider.
$map->addPlugInViewResources(array('Marker', 'InfoWindow'));

$map->add('Loader', array(
	'id' => 'loader',
	'url' => 'data/marker-provider.php',
	'viewportManagement' => TRUE,
));

echo $map;