From bfa60270a735a7a08a545a9bc1c972e8bf0bc590 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 9 Apr 2006 15:18:05 +0000 Subject: Fixed a bug about determining the cache key in TOutputCache. --- framework/Web/UI/TTemplateManager.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'framework/Web/UI/TTemplateManager.php') diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 73a336c8..07d65fd0 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -10,6 +10,11 @@ * @package System.Web.UI */ +/** + * Includes TOutputCache class file + */ +Prado::using('System.Web.UI.WebControls.TOutputCache'); + /** * TTemplateManager class * @@ -193,6 +198,10 @@ class TTemplate extends TApplicationComponent implements ITemplate * @var boolean whether this template is a source template */ private $_sourceTemplate=true; + /** + * @var string hash code of the template + */ + private $_hashCode=''; /** @@ -212,6 +221,7 @@ class TTemplate extends TApplicationComponent implements ITemplate $this->_tplFile=$tplFile; $this->_startingLine=$startingLine; $this->_content=$template; + $this->_hashCode=md5($template); $this->parse($template); $this->_content=null; // reset to save memory } @@ -241,6 +251,14 @@ class TTemplate extends TApplicationComponent implements ITemplate return $this->_directive; } + /** + * @return string hash code that can be used to identify the template + */ + public function getHashCode() + { + return $this->_hashCode; + } + /** * @return array the parsed template */ @@ -271,6 +289,8 @@ class TTemplate extends TApplicationComponent implements ITemplate if(isset($object[2])) // component { $component=Prado::createComponent($object[1]); + if($component instanceof TOutputCache) + $component->setCacheKeyPrefix($this->_hashCode.$key); $properties=&$object[2]; if($component instanceof TControl) { -- cgit v1.2.3