file, "w"); $block = TRUE; flock($fp, LOCK_EX, $block); // do an exclusive lock fwrite($fp, "\n"); fwrite($fp, " . "\"\n"); fwrite($fp, " abc=\"" . . "\">\n"); // for each group for($gid = 0; $gid < length($groups); $gid++) { fwrite($fp, " \n"); for($iid = 0; $iid < length($groups[$gid]); $iid++) { fwrite($fp, " \n"); } fwrite($fp, " \n"); } fwrite($fp, "\n"); fclose($fp); } public function show() { } private function read() { $dom = new DomDocument; $dom->resolveExternals = FALSE; $dom->substituteEntities = FALSE; $dom->preserveWhiteSpace = FALSE; $dom->load($this->file); $roadmap = $dom->documentElement; foreach($roadmap->childNodes as $group) { echo $group->getAttribute('id'); echo $group->getAttribute('name'); foreach($group->childNodes as $item) { echo $item->getAttribute('id'); echo $item->getAttribute('name'); } } } public function Roadmap($file) { $this->file = $file; if(file_exists($this->file)) $this->read(); } } ?>