4 // * Add to UML diagram and make xmi2code generate the code.
5 // * Add option to use include_path on file search.
7 class HTML_Template_HIT {
11 function HTML_Template_HIT($root = '.', $group = '') {
13 $this->group = $group;
14 $this->cache = array();
16 function parse($name, $vars = null, $val = null) {
18 $file = "{$this->root}/{$this->group}/$name.tpl.html";
20 $file = "{$this->root}/$name.tpl.html";
22 if (!isset($this->cache[$file])) {
23 $this->cache[$file] = join('', file($file));
25 //if (!is_readable($file)) {
26 // trigger_error("Can't read '$file'.");
29 if (is_string($vars)) {
30 $vars = array($vars => $val);
32 foreach ($vars as $key => $val) {
33 $keys[] = '{' . $key . '}';
36 return str_replace($keys, $vals, $this->cache[$file]);
38 return $this->cache[$file];