-? /* HTML page generator Lee Felarca http://www.zeropointnine.com/blog 4-2009 Source code licensed under a Creative Commons Attribution 3.0 License. http://creativecommons.org/licenses/by/3.0/ Some Rights Reserved. An example of parsing an XML file containing Flash site structure and content and generating HTML files from it. This isn't worth trying to adapt directly, but is here just to give you a sense of one way to go about doing it... */ $XMLFILE = "assets/content.xml"; $INCLUDEFILE_HEADER = "index_header.inc"; // load xml file $XML = simplexml_load_file($XMLFILE) or die("feed not loading"); $PAGETITLE = $XML['pageTitle']; // ------------------------------------------------- makeRootNodePage($XML); for ($i = 0; $i < sizeOf($XML->nav1); $i++) { $node1 = $XML->nav1[$i]; makeLevel1Page($node1); for ($j = 0; $j < sizeOf($node1->nav2); $j++) { $node2 = $node1->nav2[$j]; makeLevel2Page($node2, $node1); for ($k = 0; $k < sizeOf($node2->nav3); $k++) { $node3 = $node2->nav3[$k]; makeLevel3Page($node3, $node2, $node1); } } } // ------------------------------------------------- function dump($o) { echo "
"; var_dump($o); echo ""; } function saveFile($sFilename, $sText) { $s = ""; $s .= "
' . htmlspecialchars($sText) . ''; echo $s; $fp = fopen($sFilename, 'w'); echo "fopen: " . $fp; echo " fwrite: " . fwrite($fp, $sText); fclose($fp); } function makeHeading($names) { // $names is an array of names from the root, going down the list to the current node global $PAGETITLE; global $INCLUDEFILE_HEADER; // html header $s = "\r\r"; $s .= "