aboutsummaryrefslogtreecommitdiffstats
path: root/public/system/library/template/template.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/system/library/template/template.php')
-rw-r--r--public/system/library/template/template.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/public/system/library/template/template.php b/public/system/library/template/template.php
new file mode 100644
index 0000000..0c3225b
--- /dev/null
+++ b/public/system/library/template/template.php
@@ -0,0 +1,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();
+ }
+}