From 965aa3d9475a86642d33ace50d52c77987a125ea Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 26 Mar 2006 18:23:31 +0000 Subject: Added tutorial page for TExpression and TStatements. --- .../protected/pages/Controls/Expression.page | 22 +++++++++++++- .../protected/pages/Controls/Standard.page | 6 ++-- .../protected/pages/Controls/Statements.page | 35 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) (limited to 'demos/quickstart/protected') diff --git a/demos/quickstart/protected/pages/Controls/Expression.page b/demos/quickstart/protected/pages/Controls/Expression.page index 767f292f..efa1ab7a 100644 --- a/demos/quickstart/protected/pages/Controls/Expression.page +++ b/demos/quickstart/protected/pages/Controls/Expression.page @@ -4,7 +4,27 @@

-TBD +TExpression evaluates a PHP expression and displays the evaluation result. To specify the expression to be evaluated, set the Expression property. In a control template, expression tags are often used instead of the complete component tags when the main purpose is to display the evaluation result of some PHP expression. For example, the following two tags are equivalent, +

+ +<com:TExpression Expression="date()" /> +<%= date() %> + + +

+TExpression evaluates the expression during the rendering control lifecycle. +

+ +

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

+ +<com:TExpression Expression="$this->Page->Title" /> +<%= $this->Page->Title %> + + +

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

\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Standard.page b/demos/quickstart/protected/pages/Controls/Standard.page index ab485233..11c8eaec 100644 --- a/demos/quickstart/protected/pages/Controls/Standard.page +++ b/demos/quickstart/protected/pages/Controls/Standard.page @@ -19,7 +19,7 @@ TDatePicker represents an input field taking date values via a calendar dialog. -
  • * +
  • TExpression accepts a PHP expression and displays the evaluation result on a Web page.
  • @@ -95,7 +95,7 @@ TSafeHtml displays its body content with assurance that the content contain no harmful code (such as XSS). -
  • * +
  • TStatements accepts a few PHP statements and displays their standard output on the Web page.
  • @@ -107,7 +107,7 @@ TTextBox represents a text input field on a Web page. It can collect single-line, multi-line or password text input from users. -
  • * +
  • TTextHighlighter highlights its body content according to the specified syntax highlighter, such as PHP, XML, PRADO, etc.
  • diff --git a/demos/quickstart/protected/pages/Controls/Statements.page b/demos/quickstart/protected/pages/Controls/Statements.page index 28f25791..f37f1dc4 100644 --- a/demos/quickstart/protected/pages/Controls/Statements.page +++ b/demos/quickstart/protected/pages/Controls/Statements.page @@ -3,4 +3,39 @@

    TStatements

    +

    +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. In a control template, statement tags are often used instead of the complete component tags when the main purpose is to display the result rendered by some PHP statements. For example, the following two tags are equivalent, +

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

    +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. +

    + +<%% + $page=$this->Page; + echo $page->Title; +%> + + +

    +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. +

    + \ No newline at end of file -- cgit v1.2.3