* @param string $id The xml - id of ne node to fetch (needs to be a "para") * @return mixed The requested helptext as string or false if "string not found" / "helpfile not found" * @todo Don't hardcode the path */ if(function_exists('simplexml_load_file')) { function fetchHelptext($id) { static $xml; $helpfile = "../documentation/userguide.xml"; if(!is_object($xml)) { if(file_exists($helpfile) && is_readable($helpfile)) { $xml = simplexml_load_file($helpfile); } else { return false; } } $path ="//para[@id='$id']"; if ($res = $xml->xpath($path)) { $text = $res[0]; $text = preg_replace('/\s{2,}/sm',' ', $text); $text = htmlentities($text); return $text; } else { return false; } } } else { function fetchHelptext($id) { return false; } }