templateDir = BSFunctions::FetchSourcePath($dir); } // ################################################################### /** * Sets the file extension for the templates * * @param string File extension */ public function setExtension($ext) { $this->extension = $ext; } // ################################################################### /** * Takes an array of template names, loads them, and then stores a * parsed version for optimum speed. * * @param array List of template names to be cached */ public function cache($namearray) { if (sizeof($this->cache) > 0) { trigger_error('You cannot cache templates more than once per initialization'); } else { foreach ($namearray AS $name) { $template = $this->_loadTemplate($name); $template = $this->_parseTemplate($template); $this->cache["$name"] = $template; $this->usage["$name"] = 0; } } } // ################################################################### /** * Loads a template from the file system from the specified * $templatedir with the file extension $extension * * @param string The name of the template call */ private function _loadTemplate($name) { $path = BSRegister::GetAppPath() . $this->templateDir . $name . '.' . $this->extension; if (is_file($path)) { if (($template = @file_get_contents($path)) !== false) { return $template; } else { trigger_error("Could not load the template '$path'"); exit; } } else { trigger_error("Could not load the template '$path'"); exit; } } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>