diff options
author | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-03-09 23:21:23 -0400 |
---|---|---|
committer | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-03-09 23:21:23 -0400 |
commit | 7749b8ed569f6d27b0bb2ed4c2040e8b61ed4422 (patch) | |
tree | ee101992e87d740bdf0362e35ea040c866986f5a /lib/template.php | |
parent | 7bd4697dfca41a21f5857f83d6b29108fafb9a1e (diff) |
Automatic actions
Diffstat (limited to 'lib/template.php')
-rw-r--r-- | lib/template.php | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/template.php b/lib/template.php deleted file mode 100644 index 09f9aa29..00000000 --- a/lib/template.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -class Template -{ - const PATH = 'templates/'; - - // Template\load('template_name', ['bla' => 'value']); - public function load() - { - if (func_num_args() < 1 || func_num_args() > 2) { - die('Invalid template arguments'); - } - - if (! file_exists(self::PATH.func_get_arg(0).'.php')) { - die('Unable to load the template: "'.func_get_arg(0).'"'); - } - - if (func_num_args() === 2) { - - if (! is_array(func_get_arg(1))) { - die('Template variables must be an array'); - } - - extract(func_get_arg(1)); - } - - ob_start(); - - include self::PATH.func_get_arg(0).'.php'; - - return ob_get_clean(); - } - - public function layout($template_name, array $template_args = array(), $layout_name = 'layout') - { - return $this->load($layout_name, $template_args + array('content_for_layout' => $this->load($template_name, $template_args))); - } -} |