Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<com:TContent ID="body" >
2
 
3
<h1>TConditional</h1>
4
<com:DocLink ClassPath="System.Web.UI.WebControls.TConditional" />
5
 
6
<p class="block-content">
7
<tt>TConditional</tt> displays appropriate content based on the evaluation result
8
of a PHP expression specified via <tt>Condition</tt>.
9
If the result is true, it instantiates the template <tt>TrueTemplate</tt>;
10
otherwise, the template <tt>FalseTemplate</tt> is instantiated.
11
The PHP expression is evaluated right before the <tt>onInit</tt> stage of the control lifecycle.
12
</p>
13
 
14
<p class="block-content">
15
Since <tt>TConditional</tt> evaluates <tt>Condition</tt> at a very early stage, it is recommended
16
you set <tt>Condition</tt> in template only and the expression should not refer to
17
objects that are available on or after the <tt>onInit</tt> lifecycle.
18
</p>
19
 
20
<p>
21
<tt>TConditional</tt> is very light. It instantiates either <tt>TrueTemplate</tt>
22
<tt>FalseTemplate</tt>, but never both. And the condition is evaluated only once.
23
A typical usage of TConditional is shown as following:
24
</p>
25
 
26
<com:TTextHighlighter Language="prado" CssClass="source">
27
&lt;com:TConditional Condition="$this->User->IsGuest">
28
	&lt;prop:TrueTemplate>
29
		<a href="path/to/login">Login</a>
30
	&lt;/prop:TrueTemplate>
31
	&lt;prop:FalseTemplate>
32
		<a href="path/to/logout">Logout</a>
33
	&lt;/prop:FalseTemplate>
34
&lt;/com:TConditional>
35
</com:TTextHighlighter>
36
 
37
<com:RunBar PagePath="Controls.Samples.TConditional.Home" />
38
 
39
<div class="last-modified">$Id: Conditional.page 2236 2007-09-24 16:03:13Z xue $</div></com:TContent>