From 2d6584b56f0c52686f868c4c7dafc44db0f7c5cf Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 16 Jan 2006 01:50:52 +0000 Subject: Fixed an issue with dynamic property tags used with prop:xxx. --- framework/Web/UI/TTemplateManager.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index d039288e..5d17a6fe 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -608,8 +608,7 @@ class TTemplate extends TComponent implements ITemplate if($matchStart>$textStart && $container>=0) { $value=substr($input,$textStart,$matchStart-$textStart); - //$tpl[$container][2][$prop]=$this->parseAttribute($value); - $tpl[$container][2][$prop]=$value; + $tpl[$container][2][$prop]=$this->parseAttribute($value); $textStart=$matchEnd+1; } $expectPropEnd=false; @@ -685,9 +684,11 @@ class TTemplate extends TComponent implements ITemplate protected function parseAttribute($value) { - if(!preg_match('/(<%#.*?%>|<%=.*?%>|<%~.*?%>|<%\\$.*?%>)/msS',$value)) + $matches=array(); + if(!preg_match('/^\s*(<%#.*?%>|<%=.*?%>|<%~.*?%>|<%\\$.*?%>)\s*$/msS',$value,$matches)) return $value; - else if($value[2]==='#') // databind + $value=$matches[1]; + if($value[2]==='#') // databind return array(self::CONFIG_DATABIND,substr($value,3,strlen($value)-5)); else if($value[2]==='=') // a dynamic initialization return array(self::CONFIG_EXPRESSION,substr($value,3,strlen($value)-5)); -- cgit v1.2.3