summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/quickstart/protected/pages/Configurations/Templates3.page14
-rw-r--r--framework/Web/UI/TTemplateManager.php2
2 files changed, 15 insertions, 1 deletions
diff --git a/demos/quickstart/protected/pages/Configurations/Templates3.page b/demos/quickstart/protected/pages/Configurations/Templates3.page
index 99d43665..bc3b1f87 100644
--- a/demos/quickstart/protected/pages/Configurations/Templates3.page
+++ b/demos/quickstart/protected/pages/Configurations/Templates3.page
@@ -44,6 +44,20 @@ The format of databind tags is as follows,
<com:TTextHighlighter Language="prado" CssClass="source">
&lt;%# PhpExpression %&gt;
</com:TTextHighlighter>
+<p>
+Since v3.0.2, expression tags and databind tags can be embedded within static strings. For example, you can write the following in a template,
+</p>
+<com:TTextHighlighter Language="prado" CssClass="source">
+&lt;com:TLabel&gt;
+ &lt;prop:Text&gt;
+ Today is &lt;%= date('F d, Y',time()) &gt;.
+ The page class is &lt;%= get_class($this) %&gt;.
+ &lt;/prop:Text&gt;
+&lt;/com:TLabel&gt;
+</com:TTextHighlighter>
+<p>
+Previously, you would have to use a single expression with string concatenations to achieve the same effect.
+</p>
<a name="pt"></a>
<h3 id="1705">Parameter Tags</h3>
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index c9cf564d..a68e8762 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -799,7 +799,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
}
$length=strlen($value);
if($length>$textStart)
- $expr.=".'".substr($value,$textStart,$length-$textStart)."'";
+ $expr.=".'".strtr(substr($value,$textStart,$length-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'";
if($isDataBind)
return array(self::CONFIG_DATABIND,ltrim($expr,'.'));
else