blob: 0c3225b7aa2ce3a5c456cc55002b69fab73dc9d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<?php
namespace Template;
final class Template {
private $data = array();
public function set($key, $value) {
$this->data[$key] = $value;
}
public function render($template) {
$file = DIR_TEMPLATE . $template . '.tpl';
if (is_file($file)) {
extract($this->data);
ob_start();
require($file);
return ob_get_clean();
}
throw new \Exception('Error: Could not load template ' . $file . '!');
exit();
}
}
|