In order to pull data from an XML file, the easiest way is to use the built-in function simplexml_load_file. PHP 5 must be installed on your web server, though. The code below should give you the general idea on how to get started.
<?php
$file = simplexml_load_file("myfile.xml");
foreach ($file->topNode as $value) {
echo $value->secondaryNode;
}
?>
This code will go into your xml file loop through each node and print out all of the secondary nodes within your document.
Try my gator hunting game available on iPhone in the iTunes App Store
If you are interested in iPhone or Android app development, then you have come to the right place
Tuesday, May 14, 2013
Friday, May 3, 2013
HTML5 Geolocation tutorial
If you're trying to capture a user's latitude and longitude coordinates in order to plug into an api, below is the easiest way I have found.
function userLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showData);
} else {
alert("not supported");
}
function showData(position) {
var x= position.coords.latitude;
var y = position.coords.longitude;
$("#mydiv").html("latitude: " + x + "<br/>longitude" + y);
}
}
Check out my golf game for iPhone
function userLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showData);
} else {
alert("not supported");
}
function showData(position) {
var x= position.coords.latitude;
var y = position.coords.longitude;
$("#mydiv").html("latitude: " + x + "<br/>longitude" + y);
}
}
Check out my golf game for iPhone
Subscribe to:
Posts (Atom)