diff options
-rw-r--r-- | day.php | 7 | ||||
-rw-r--r-- | functions/template.php | 14 |
2 files changed, 13 insertions, 8 deletions
@@ -43,10 +43,13 @@ $logout_querys = logout_querys(); $page = new Page(BASE.'templates/'.$template.'/day.tpl'); -$page->replace_tags(array( +$page->replace_files(array( 'header' => BASE.'templates/'.$template.'/header.tpl', 'footer' => BASE.'templates/'.$template.'/footer.tpl', - 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl', + 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl' + )); + +$page->replace_tags(array( 'event_js' => BASE.'functions/event.js', 'charset' => $charset, 'default_path' => '', diff --git a/functions/template.php b/functions/template.php index d2f5a36..008cdec 100644 --- a/functions/template.php +++ b/functions/template.php @@ -903,9 +903,6 @@ class Page { if (sizeof($tags) > 0) foreach ($tags as $tag => $data) { - // This opens up another template and parses it as well. - $data = (file_exists($data)) ? $this->parse($data) : $data; - // This removes any unfilled tags if (!$data) { $this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->(.*)<\!-- switch ' . $tag . ' off -->!is', '', $this->page); @@ -914,9 +911,14 @@ class Page { // This replaces any tags $this->page = str_replace('{' . strtoupper($tag) . '}', $data, $this->page); } - - else - die('No tags designated for replacement.'); + } + + function replace_files($tags = array()) { + if (sizeof($tags) > 0) + foreach ($tags as $tag => $data) { + // This opens up another template and parses it as well. + $data = (file_exists($data)) ? $this->parse($data) : $data; + } } function output() { |