file = $file; } /** * set in {@link $values} the relations "keys/values" * @param string|integer $key the key to declare (remplaced in template a [@tag] * @param string|integer $value the value to set */ public function set($key, $value) { $this->values[$key] = $value; } /** * Take {@link $values} data * and change the tags in {@link $file} * and return the result * @return string */ public function output() { if (!file_exists($this->file)) { return 'Error loading template file (' .$this->file. ').' . "\r\n"; } $output = file_get_contents($this->file); foreach ($this->values as $key => $value) { $tag = '[@' . $key . ']'; $output = str_replace($tag, $value, $output); } return $output; } }