summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected/pages/Controls')
-rw-r--r--demos/quickstart/protected/pages/Controls/Conditional.page39
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.page14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php7
-rw-r--r--demos/quickstart/protected/pages/Controls/Standard.page6
4 files changed, 65 insertions, 1 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Conditional.page b/demos/quickstart/protected/pages/Controls/Conditional.page
new file mode 100644
index 00000000..e8ea4a65
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Conditional.page
@@ -0,0 +1,39 @@
+<com:TContent ID="body" >
+
+<h1>TConditional</h1>
+<com:DocLink ClassPath="System.Web.UI.WebControls.TConditional" />
+
+<p class="block-content">
+<tt>TConditional</tt> displays appropriate content based on the evaluation result
+of a PHP expression specified via <tt>Condition</tt>.
+If the result is true, it instantiates the template <tt>TrueTemplate</tt>;
+otherwise, the template <tt>FalseTemplate</tt> is instantiated.
+The PHP expression is evaluated right before the <tt>onInit</tt> stage of the control lifecycle.
+</p>
+
+<p class="block-content">
+Since <tt>TConditional</tt> evaluates <tt>Condition</tt> at a very early stage, it is recommended
+you set <tt>Condition</tt> in template only and the expression should not refer to
+objects that are available on or after the <tt>onInit</tt> lifecycle.
+</p>
+
+<p>
+<tt>TConditional</tt> is very light. It instantiates either <tt>TrueTemplate</tt>
+<tt>FalseTemplate</tt>, but never both. And the condition is evaluated only once.
+A typical usage of TConditional is shown as following:
+</p>
+
+<com:TTextHighlighter Language="prado" CssClass="source">
+&lt;com:TConditional Condition="$this->User->IsGuest">
+ &lt;prop:TrueTemplate>
+ <a href="path/to/login">Login</a>
+ &lt;/prop:TrueTemplate>
+ &lt;prop:FalseTemplate>
+ <a href="path/to/logout">Logout</a>
+ &lt;/prop:FalseTemplate>
+&lt;/com:TConditional>
+</com:TTextHighlighter>
+
+<com:RunBar PagePath="Controls.Samples.TConditional.Home" />
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.page
new file mode 100644
index 00000000..0c099551
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.page
@@ -0,0 +1,14 @@
+<com:TContent ID="body">
+<h1>TConditional Samples</h1>
+
+<com:TConditional Condition="Prado::getVersion()==='3.1.1'">
+<prop:TrueTemplate>
+ <com:TLabel Text="You are using PRADO 3.1.1" />
+</prop:TrueTemplate>
+<prop:FalseTemplate>
+ <com:TLabel Text="You are using PRADO <%= Prado::getVersion() %>" />
+</prop:FalseTemplate>
+</com:TConditional>
+
+<div class="last-modified">$Id$</div>
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php
new file mode 100644
index 00000000..badbca73
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php
@@ -0,0 +1,7 @@
+<?php
+
+class Home extends TPage
+{
+}
+
+?> \ 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 2b8dd7ab..3b6079d6 100644
--- a/demos/quickstart/protected/pages/Controls/Standard.page
+++ b/demos/quickstart/protected/pages/Controls/Standard.page
@@ -28,6 +28,10 @@
</li>
<li>
+ <a href="?page=Controls.Conditional">TConditional</a> displays content corresponding to true or false result of a PHP expression.
+ </li>
+
+ <li>
<a href="?page=Controls.DatePicker">TDatePicker</a> represents an input field taking date values via a calendar dialog.
</li>
@@ -122,7 +126,7 @@
<li>
<a href="?page=Controls.Slider">TSlider</a> represents a Slider control
</li>
-
+
<li>
<a href="?page=Controls.Statements">TStatements</a> accepts a few PHP statements and displays their standard output on the Web page.
</li>