summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TTemplateManager.php
diff options
context:
space:
mode:
authorxue <>2006-04-09 15:18:05 +0000
committerxue <>2006-04-09 15:18:05 +0000
commitbfa60270a735a7a08a545a9bc1c972e8bf0bc590 (patch)
tree032f3bb44f1cbf96cf3c311082a3a32b146ca277 /framework/Web/UI/TTemplateManager.php
parentd8122a0f98137822b0ea20f7602d105fcb2fe962 (diff)
Fixed a bug about determining the cache key in TOutputCache.
Diffstat (limited to 'framework/Web/UI/TTemplateManager.php')
-rw-r--r--framework/Web/UI/TTemplateManager.php20
1 files changed, 20 insertions, 0 deletions
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
@@ -11,6 +11,11 @@
*/
/**
+ * Includes TOutputCache class file
+ */
+Prado::using('System.Web.UI.WebControls.TOutputCache');
+
+/**
* TTemplateManager class
*
* TTemplateManager manages the loading and parsing of control templates.
@@ -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
}
@@ -242,6 +252,14 @@ class TTemplate extends TApplicationComponent implements ITemplate
}
/**
+ * @return string hash code that can be used to identify the template
+ */
+ public function getHashCode()
+ {
+ return $this->_hashCode;
+ }
+
+ /**
* @return array the parsed template
*/
public function &getItems()
@@ -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)
{