blob: c87f0ba4fbb161d680157fea19d3033acaff28b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<com:TContent ID="body" >
<h1>TExpression</h1>
<com:DocLink ClassPath="System.Web.UI.WebControls.TExpression" />
<p>
<tt>TExpression</tt> evaluates a PHP expression and displays the evaluation result. To specify the expression to be evaluated, set the <tt>Expression</tt> property. In a control template, <a href="?page=Configurations.Templates2#et">expression tags</a> are often used instead of the complete <a href="?page=Configurations.Templates1#ct">component tags</a> when the main purpose is to display the evaluation result of some PHP expression. For example, the following two tags are equivalent,
</p>
<com:TTextHighlighter Language="prado" CssClass="source">
<com:TExpression Expression="date()" />
<%= date() %>
</com:TTextHighlighter>
<p>
<tt>TExpression</tt> evaluates the expression during the rendering control lifecycle.
</p>
<p>
The context of the expression in a <tt>TExpression</tt> control is the control itself. That is, <tt>$this</tt> represents the control object if it is present in the expression. For example, both of the following template tags will display the title of the page containing the <tt>TExpression</tt> control.
</p>
<com:TTextHighlighter Language="prado" CssClass="source">
<com:TExpression Expression="$this->Page->Title" />
<%= $this->Page->Title %>
</com:TTextHighlighter>
<p>
Be aware, since <tt>TExpression</tt> allows execution of arbitrary PHP code, in general you should not use it to evaluate expressions submitted by your application users.
</p>
<com:RunBar PagePath="Controls.Samples.TExpression.Home" />
</com:TContent>
|