| 1 |
lars |
1 |
<com:TContent ID="body" >
|
|
|
2 |
|
|
|
3 |
<h1 id="4301">TStatements</h1>
|
|
|
4 |
<com:DocLink ClassPath="System.Web.UI.WebControls.TStatements" />
|
|
|
5 |
|
|
|
6 |
<p id="500310" class="block-content">
|
|
|
7 |
<tt>TStatements</tt> evaluates a sequence of PHP statements and displays the content rendered by the statements. To specify the PHP statements to be evaluated, set the <tt>Statements</tt> property. For example, the following component tag displays the current time on the Web page,
|
|
|
8 |
</p>
|
|
|
9 |
<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_500111">
|
|
|
10 |
<com:TStatements>
|
|
|
11 |
<prop:Statements>
|
|
|
12 |
setlocale(LC_ALL, 'nl_NL');
|
|
|
13 |
echo strftime("%A %e %B %Y",time());
|
|
|
14 |
</prop:Statements>
|
|
|
15 |
</com:TStatements>
|
|
|
16 |
</com:TTextHighlighter>
|
|
|
17 |
|
|
|
18 |
<p id="500311" class="block-content">
|
|
|
19 |
Note, <tt>TStatements</tt> evaluates the PHP statements during the rendering control lifecycle. Unlike <tt>TExpression</tt>, <tt>TStatements</tt> only displays the content 'echoed' within the statements.
|
|
|
20 |
</p>
|
|
|
21 |
|
|
|
22 |
<p id="500312" class="block-content">
|
|
|
23 |
The context of the statements in a <tt>TStatements</tt> control is the control itself. That is, <tt>$this</tt> represents the control object if it is present in the statements. For example, the following statement tag will display the title of the page containing the <tt>TStatements</tt> control.
|
|
|
24 |
</p>
|
|
|
25 |
<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_500112">
|
|
|
26 |
<com:TStatements>
|
|
|
27 |
<prop:Statements>
|
|
|
28 |
$page=$this->Page;
|
|
|
29 |
echo $page->Title;
|
|
|
30 |
</prop:Statements>
|
|
|
31 |
</com:TStatements>
|
|
|
32 |
</com:TTextHighlighter>
|
|
|
33 |
|
|
|
34 |
<p id="500313" class="block-content">
|
|
|
35 |
Be aware, since <tt>TStatements</tt> allows execution of arbitrary PHP code, in general you should not use it to evaluate PHP code submitted by your application users.
|
|
|
36 |
</p>
|
|
|
37 |
|
|
|
38 |
<com:RunBar PagePath="Controls.Samples.TStatements.Home" />
|
|
|
39 |
|
|
|
40 |
<div class="last-modified">$Id: Statements.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
|