PHP Classes

File: example3.php

Recommend this page to a friend!
  Classes of Sven Weih   N/X API to Google Maps   example3.php   Download  
File: example3.php
Role: Example script
Content type: text/plain
Description: Example File
Class: N/X API to Google Maps
Present world maps with Google Maps API
Author: By
Last change:
Date: 17 years ago
Size: 1,298 bytes


Class file image Download
require "nxgooglemapsapi.php";

$api = new NXGoogleMapsAPI();

// setup the visual design of the control

// define points
$points = array(array(50,10,'Point1'), array(51,15, 'Point2'));

// add a point.
for ($i=0; $i<count($points); $i++) {
$api->addGeoPoint($points[$i][0],$points[$i][1], $points[$i][2] , true);

//define addresses
$addresses = array(array('Stuttgart, Germany', 'Stuttgart'), array('Munich, Germany', 'Munich'));

// add the addresses
for ($i=0; $i<count($addresses); $i++) {
$api->addAddress($addresses[$i][0], $addresses[$i][1], true);


<?php echo $api->getHeadCode(); ?>


<body onLoad="<?php echo $api->getOnLoadCode(); ?>">

<h1> Scrolling the map </h1>

<?php echo $api->getBodyCode(); ?>
// draw the links for the geopoints
for ($i=0; $i< count($points); $i++) {
'<a href="#" onclick="moveToGeopoint('.$i.');">Move to '.$points[$i][2].'</a><br>';

// draw the links for the addresses
for ($i=0; $i< count($addresses); $i++) {
'<a href="#" onclick="moveToGeopoint('.$i.');">Move to '.$addresses[$i][1].'</a><br>';