TStatements

API Manual

TStatements evaluates a sequence of PHP statements and displays the content rendered by the statements. To specify the PHP statements to be evaluated, set the Statements property. For example, the following component tag displays the current time on the Web page,

<com:TStatements>
  <prop:Statements>
  setlocale(LC_ALL, 'nl_NL');
  echo strftime("%A %e %B %Y",time());
  </prop:Statements>
</com:TStatements>

Note, TStatements evaluates the PHP statements during the rendering control lifecycle. Unlike TExpression, TStatements only displays the content 'echoed' within the statements.

The context of the statements in a TStatements control is the control itself. That is, $this 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 TStatements control.

<com:TStatements>
  <prop:Statements>
  $page=$this->Page;
  echo $page->Title;
  </prop:Statements>
</com:TStatements>

Be aware, since TStatements allows execution of arbitrary PHP code, in general you should not use it to evaluate PHP code submitted by your application users.