From 90e3aab1c0c819c3e0f0870cf133527af7705ea6 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 15 Dec 2005 04:02:57 +0000 Subject: Added a new feature about using databind expression in template. --- framework/Web/UI/TTemplateManager.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 6864e038..c14b2e0b 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -138,9 +138,9 @@ class TTemplate extends TComponent implements ITemplate * '<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>' - component tags * '<\/?prop:([\w\.]+)\s*>' - property tags * '<%@\s*(\w+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>' - directives - * '<%=?(.*?)%>' - expressions + * '<%=?(.*?)%> | <%#(.*?)%>' - expressions */ - const REGEX_RULES='/||<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%=?(.*?)%>/msS'; + const REGEX_RULES='/||<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%[#=]?(.*?)%>/msS'; /** * @var array list of component tags and strings @@ -461,9 +461,11 @@ class TTemplate extends TComponent implements ITemplate if($matchStart>$textStart) $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart)); $textStart=$matchEnd+1; - if($str[2]==='=') + if($str[2]==='=') // expression $tpl[$c++]=array($container,'TExpression',array('Expression'=>$match[5][0])); - else + else if($str[2]==='#') // binding expression + $tpl[$c++]=array($container,'TLiteral',array('Text'=>array(0,$match[5][0]))); + else // statements $tpl[$c++]=array($container,'TStatements',array('Statements'=>$match[5][0])); } else if(strpos($str,'