I have this code that finds every xml file in a directory and then grabs the dates. But I want it instead to echo each line in each xml file in the directory. the xml files look like this
<event>
<day>11</day>
<month>01</month>
<year>2013</year>
<link>link</link>
<title>Title</title>
<description></description>
</event>
and my php code
$events = array();
// open each xml file in this directory
foreach(glob("*.xml") as $filename) {
// get the contents of the the current file
$xml_file = file_get_contents($filename, FILE_TEXT);
// create a simplexml object from the contents of the current file
$xml = simplexml_load_string($xml_file);
// create a day, link, description, etc.
$eventDay = (int)$xml->day;
$eventMonth = (int)$xml->month;
$eventYear = (int)$xml->year;
$eventLink = (string)$xml->link;
$eventDesc = (string)$xml->description;
if($eventMonth == $month && $eventYear == $year)
$events[$eventDay] = array($eventLink,'linked-day');
}
return $events;
}
so for example for each file found it would print out something like
<div class="event"><p>Date: month/day/year</p><p>Title: the xml title</p><p>description: the xml description</p></div>