Work
- Work through the tutorial, creating a simple timeline as far as the section on Differentiating the Two Bands
- Create a new xml file of events in the required format which represents the University calendar or some other set of events
This blog supports the group of students taking Data, Schemas and Applications UFIEKG-20-3, a module taught in the Information Systems School at the University of the West of England in Bristol, UK
//assume places.xml contains multiple places, each with a name and description
$placesxml = simplexml_load_file("places.xml");
$places = $placesxml->xpath("//Place");
// $places is now an array of XML elements, each a Place element
foreach ($places as $place) {
//$place now points to each Place in the XML document in turn
// so we can use object references to access the elements within a Place
print $place->name, $place->description;
// or even XPath expression as well
// and of course, if the are repeated elements in Place, such Link, with elements
//url and text, we can use a inner loop to work with these
foreach( $place->Link as $link) {
print "<a href='$link->url'/>$link->text</a>"
}
}