/** * Load a template by path -- first look in the templates folder for an override * * This function tries to get the template from the cache. If it cannot be found * the template file will be loaded from the file system. * * @param string The template path * @param array An associative array of data to be extracted in local template scope * @return KTemplateAbstract */ public function loadFile($path, $data = array(), $process = true) { if (isset($this->_cache)) { $identifier = md5($path); if ($template = $this->_cache->get($identifier)) { // store the path $this->_path = $path; $this->loadString($template, $data, $process); return $this; } } return parent::loadFile($path, $data, $process); }
/** * Load a template by path * * @param string The template path * @param array An associative array of data to be extracted in local template scope * @param boolean If TRUE process the data using a tmpl stream. Default TRUE. * @return KTemplateAbstract */ public function loadFile($file, $data = array(), $process = true) { //tracks the recursive paths $this->_load_stack[] = $file; $data['__FILE__'] = $file; $data['__DIR__'] = dirname($file); $result = parent::loadFile($file, $data, $process); array_pop($this->_load_stack); //the path $this->_path = end($this->_load_stack); return $result; }