source: trunk/src/index.php@ 7740

Last change on this file since 7740 was 7728, checked in by rick, 15 years ago

Make the <xml the first part of the output (as dirty hack) to allow validation of the xml with comments

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1<?php
2/*
3 * Project: NodeMap2.0
4 * File: index.php
5 * Purpose: Main index file of application
6 */
7
8require_once('config.php');
9require_once($config['file_init']);
10
11// Make it parse properly within Firefox so that it will display a DOM tree
12header('Content-Type: text/xml');
13
14// And echo the result to the screen
15// TODO: Need to fix this wierd error... Or is it just USBWebserver? Line is invisible!
16echo '<?xml version="1.0" encoding="UTF-8"?>';
17
18// Creating a placemark using our class
19$kmlPlacemark1 = new KMLPlacemark();
20$kmlPlacemark1->setName('Test name');
21$kmlPlacemark1->setDescriptionLocation('Test location description');
22$kmlPlacemark1->setDescriptionStatus('Test status description');
23$kmlPlacemark1->setLatitude(52.138476);
24$kmlPlacemark1->setLongitude(4.463046);
25$kmlPlacemark1->setStyle(PLACEMARK_GREEN);
26
27// Creating a second placemark using our class
28$kmlPlacemark2 = new KMLPlacemark();
29$kmlPlacemark2->setName('Placemark 2 name');
30$kmlPlacemark2->setDescriptionLocation('This is the second placemark location description');
31$kmlPlacemark2->setDescriptionStatus('This is the second placemark status description');
32$kmlPlacemark2->setLatitude(52.638476);
33$kmlPlacemark2->setLongitude(4.063046);
34$kmlPlacemark2->setStyle(PLACEMARK_ORANGE);
35
36// Creating a KMLFile using our class, add our placemarks and echo
37$kml = new KMLFile();
38$kml->addPlacemark($kmlPlacemark1);
39$kml->addPlacemark($kmlPlacemark2);
40/*
41 * For testing, echo the example KML file
42 * echo $kml->toString();
43 * echo "\r\n\r\n\r\n\r\n\r\n -------------------------------------------------- \r\n\r\n\r\n\r\n\r\n";
44 */
45
46// Now let's try reading from files and parsing the data in the files.
47// First off, we create a new KMLFile object
48$kmlFile = new KMLFile();
49
50// Let's try to read the node location file
51$nodeLocation = new FileHandler($config['node_location_file'], 'r');
52$kmlFile->parseLocationFile($nodeLocation->read());
53/*
54 * For testing, echo the example KML file
55 * echo $kmlFile->toString();
56 * echo "\r\n\r\n\r\n\r\n\r\n -------------------------------------------------- \r\n\r\n\r\n\r\n\r\n";
57 */
58
59// Let's try to read the node status file
60$nodeStatus = new FileHandler($config['node_status_file'], 'r');
61$kmlFile->parseStatusFile($nodeStatus->read());
62
63echo $kmlFile->toString();
64?>
Note: See TracBrowser for help on using the repository browser.