From 20b4da0690a7e8744e8d6c65173436c222c01a2d Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 18 Aug 2004 00:08:33 +0000 Subject: Modified for speed and stat errors. --- day.php | 7 +++++-- functions/template.php | 14 ++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/day.php b/day.php index 3c9537e..b9b22f5 100644 --- a/day.php +++ b/day.php @@ -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() { -- cgit v1.2.3