summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Configurations/Templates3.page
diff options
context:
space:
mode:
authorxue <>2005-12-26 15:54:54 +0000
committerxue <>2005-12-26 15:54:54 +0000
commit9be8859d92e4bbec2462e82457d014f0a0d720db (patch)
tree8d674a443ab0785d2a68dbfa326abfae3230bbb5 /demos/quickstart/protected/pages/Configurations/Templates3.page
parenta433c6c39bdaa5a53238596853617228be8ad07f (diff)
Diffstat (limited to 'demos/quickstart/protected/pages/Configurations/Templates3.page')
-rw-r--r--demos/quickstart/protected/pages/Configurations/Templates3.page73
1 files changed, 73 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Configurations/Templates3.page b/demos/quickstart/protected/pages/Configurations/Templates3.page
new file mode 100644
index 00000000..328687fb
--- /dev/null
+++ b/demos/quickstart/protected/pages/Configurations/Templates3.page
@@ -0,0 +1,73 @@
+<com:TContent ID="body" >
+<h1>Templates: Part III</h1>
+
+<a name="dpt" />
+<h2>Dynamic Property Tags</h2>
+<p>
+Dynamic property tags are very similar to dynamic content tags, except that they are applied to component properties. The purpose of dynamic property tags is to allow more versatile component property configuration. Note, you are not required to use dynamic property tags because what can be done using dynamic property tags can also be done in PHP code. However, using dynamic property tags bring you much more convenience at accomplishing the same tasks. The basic usage of dynamic property tags is as follows,
+<pre class="source">
+&lt;com:ComponentType PropertyName=DynamicPropertyTag ...&gt;
+body content
+&lt;/com:ComponentType&gt;
+</pre>
+where you may enclose <code>DynamicPropertyTag</code> within single or double quotes for better readability.
+</p>
+<p>
+We now introduce the available types of dynamic property tags that may be used in the above. Like dynamic content tags, we have <a href="#et">expression tags</a>, <a href="#dt">databind tags</a>, <a href="#pt">parameter tags</a> and <a href="#at">asset tags</a>. (Note, there is no statement tag here.)
+</p>
+
+<a name="et" />
+<h3>Expression Tags</h3>
+<p>
+An expression tag represents a PHP expression that is evaluated when the template is being instantiated. The expression evaluation result is assigned to the corresponding component property. The format of expression tags is as follows,
+<pre class="source">
+&lt;%= PhpExpression %&gt;
+</pre>
+In the expression, <code>$this</code> refers to the component specified by the component tag. The following example specifies a <code>TLabel</code> control whose <code>Text</code> property is initialized as the current page title when the <code>TLabel</code> control is being constructed,
+<pre class="source">
+&lt;com:TLabel Text=&lt;%= $this-&gt;Page-&gt;Title %&gt; /&gt;
+</pre>
+</p>
+<p>
+Note, unlike dynamic content tags, the expressions tags for component properties are evaluated when the components are being constructed, while for the dynamic content tags, the expressions are evaluated when the controls are being rendered.
+</p>
+
+<a name="dt" />
+<h3>Databind Tags</h3>
+<p>
+Databind tags are similar to expression tags, except that the expressions are evaluated only when a <code>dataBind()</code> call is invoked on the controls represented by the component tags. In the expression, <code>$this</code> refers to the control itself. Databind tags do not apply to all components. They can only be used for controls.
+</p>
+<p>
+The format of databind tags is as follows,
+<pre class="source">
+&lt;%# PhpExpression %&gt;
+</pre>
+</p>
+
+<a name="pt" />
+<h3>Parameter Tags</h3>
+<p>
+Parameter tags are used to assign application parameter values to the corresponding component properties. The format of parameter tags is as follows,
+<pre class="source">
+&lt;%$ ParameterName %&gt;
+</pre>
+Note, application parameters are usually defined in application configurations or page directory configurations. The parameters are evaluated when the template is instantiated.
+</p>
+
+<a name="at" />
+<h3>Asset Tags</h3>
+<p>
+Asset tags are used to publish private files and assign the corresponding the URLs to the component properties. For example, if you have an image file that is not Web-accessible and you want to make it visible to end-users, you can use asset tags to publish this file and show the URL to end-users so that they can fetch the published image.
+</p>
+<p>
+The format of asset tags is as follows,
+<pre class="source">
+&lt;%~ LocalFileName %&gt;
+</pre>
+where <code>LocalFileName</code> refers to a file path that is relative to the directory containing the current template file. The file path can be a single file or a directory. If the latter, the content in the whole directory will be made accessible by end-users.
+</p>
+<p>
+BE VERY CAUTIOUS when you are using asset tags as it may expose to end-users files that you probably do not want them to see.
+</p>
+
+</com:TContent> \ No newline at end of file