summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TTemplateManager.php
diff options
context:
space:
mode:
authorxue <>2005-12-15 04:02:57 +0000
committerxue <>2005-12-15 04:02:57 +0000
commit90e3aab1c0c819c3e0f0870cf133527af7705ea6 (patch)
tree52eeef316f48d891fe91fc2baf09dce837041070 /framework/Web/UI/TTemplateManager.php
parentffb5532d95e98a300a9afacf2b0480d9ce93246d (diff)
Added a new feature about using databind expression in template.
Diffstat (limited to 'framework/Web/UI/TTemplateManager.php')
-rw-r--r--framework/Web/UI/TTemplateManager.php10
1 files changed, 6 insertions, 4 deletions
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,'<prop:')===0) // opening property