template = $template; else die("Template file $template not found."); $path = explode('/', $_SERVER['SCRIPT_NAME']); array_pop($path); array_shift($path); $walktree = array(); $this->setChannel(implode('/', $path)); foreach($path as $p) { array_push($walktree, implode('/', $path)); array_pop($path); } $walktree = array_reverse($walktree); $this->setTitle($title); $this->setNavbar($root . '/' . $this->get('channel') . '/' . $navbarFile); // adding these to the content hash will make them visible within the template $this->set('docroot', $root); $this->set('template', $template); $this->set('path', $path); $this->set('walktree', $walktree); } function set($name, $value) { $this->content[$name] = $value; } function get($name) { $value = $this->content[$name]; return($value); } function setTitle($value) { $this->set('title', $value); } function setBody($value) { $this->set('body', $value); } function setNavbar($navbar) { $this->set('navbar', $navbar); } function setChannel($value) { $this->set('channel',$value); } function display($body) { $this->setBody($body); extract($this->content); ob_start(); include($this->template); $this->output = ob_get_contents(); ob_end_clean(); echo($this->output); } } ?>