Last change
on this file since 7783 was 7769, checked in by janveeden, 15 years ago |
Fixed map to work again (went back a revision). Next up is config to work again. (Backed-up broken map).
|
-
Property svn:eol-style
set to
native
|
File size:
980 bytes
|
Rev | Line | |
---|
[7725] | 1 | <?php
|
---|
[7769] | 2 | //$file contains place of the KML file we will be getting our node information from
|
---|
| 3 | function get_node_array($file)
|
---|
[7725] | 4 | {
|
---|
[7767] | 5 | //Check if the file exists, if it does we load it. If it doesn't we exit and return an error message
|
---|
| 6 | if (file_exists($file))
|
---|
| 7 | {
|
---|
| 8 | $xml = simplexml_load_file($file);
|
---|
| 9 | }
|
---|
| 10 | else
|
---|
| 11 | {
|
---|
[7769] | 12 | exit('Failed to open example.xml.');
|
---|
[7767] | 13 | }
|
---|
[7725] | 14 |
|
---|
[7767] | 15 | //Counter starts at 0. For every foreach done counter will go up by one. Thus resulting in total nodes added(counter starts at 0 so add 1 to the total )
|
---|
| 16 | $counter = 0;
|
---|
| 17 |
|
---|
| 18 | //Now we go through the xml files, storing the data in an array called $markers. More data can be stored by adding more rows in the array
|
---|
| 19 | foreach($xml->Document->Folder->Placemark as $placemark)
|
---|
| 20 | {
|
---|
| 21 |
|
---|
[7769] | 22 | $markers[] = array( "latitude"=>$placemark->LookAt->latitude,
|
---|
[7767] | 23 | "longitude"=>$placemark->LookAt->longitude,
|
---|
| 24 | "name"=>$placemark->name,
|
---|
| 25 | "description"=>$placemark->description,
|
---|
| 26 | "id"=>$counter);
|
---|
| 27 | $counter++;
|
---|
| 28 | }
|
---|
| 29 | return $markers;
|
---|
[7722] | 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.