From 2d64368647a8aa1afff52eaea20b1416e51f9e85 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 15 Jan 2006 01:15:21 +0000 Subject: Modified the way of creating templates. --- framework/Web/UI/WebControls/TRepeater.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php index c71f6590..a75fd63e 100644 --- a/framework/Web/UI/WebControls/TRepeater.php +++ b/framework/Web/UI/WebControls/TRepeater.php @@ -293,26 +293,24 @@ class TRepeater extends TDataBoundControl implements INamingContainer protected function createTemplate($str) { $key=md5($str); - $contextPath=$this->getTemplateControl()->getTemplate()->getContextPath(); - if(($cache=$this->getApplication()->getCache())!==null) + if(isset(self::$_templates[$key])) + return self::$_templates[$key]; + else { - if(($template=$cache->get($key))===null) + $contextPath=$this->getTemplateControl()->getTemplate()->getContextPath(); + if(($cache=$this->getApplication()->getCache())!==null) { - $template=new TTemplate($str,$contextPath); - $cache->set($key,$template,self::CACHE_EXPIRY); + if(($template=$cache->get($key))===null) + { + $template=new TTemplate($str,$contextPath); + $cache->set($key,$template,self::CACHE_EXPIRY); + } } - } - else - { - if(isset(self::$_templates[$key])) - $template=self::$_templates[$key]; else - { $template=new TTemplate($str,$contextPath); - self::$_templates[$key]=$template; - } + self::$_templates[$key]=$template; + return $template; } - return $template; } /** -- cgit v1.2.3