diff options
author | wei <> | 2007-01-14 02:10:24 +0000 |
---|---|---|
committer | wei <> | 2007-01-14 02:10:24 +0000 |
commit | 45b0fe42a979d444d547a5248eb2e9e915aaf16a (patch) | |
tree | 2480dae3350e4a70949956c41984cceb8dce3efc /demos/quickstart/protected/pages/Configurations | |
parent | 898049a4012eaecd99e7a418726215e656677809 (diff) |
Add "block-content" to allow user comments on block level elements in quickstart docs.
Diffstat (limited to 'demos/quickstart/protected/pages/Configurations')
7 files changed, 103 insertions, 103 deletions
diff --git a/demos/quickstart/protected/pages/Configurations/AppConfig.page b/demos/quickstart/protected/pages/Configurations/AppConfig.page index e15f1eea..97db019f 100644 --- a/demos/quickstart/protected/pages/Configurations/AppConfig.page +++ b/demos/quickstart/protected/pages/Configurations/AppConfig.page @@ -1,12 +1,12 @@ <com:TContent ID="body" >
<h1 id="1801">Application Configurations</h1>
-<p>
+<p id="210213" class="block-content">
Application configurations are used to specify the global behavior of an application. They include specification of path aliases, namespace usages, module and service configurations, and parameters.
</p>
-<p>
+<p id="210214" class="block-content">
Configuration for an application is stored in an XML file named <tt>application.xml</tt>, which should be located under the application base path. Its format is shown in the following,
-<com:TTextHighlighter Language="xml" CssClass="source">
+<com:TTextHighlighter Language="xml" CssClass="source block-content" id="code_210095">
<application PropertyName="PropertyValue" ...>
<paths>
<alias id="AliasID" path="AliasPath" />
@@ -24,22 +24,22 @@ Configuration for an application is stored in an XML file named <tt>application. </application>
</com:TTextHighlighter>
</p>
-<ul>
+<ul id="u1" class="block-content">
<li>The outermost element <tt><application></tt> corresponds to the <tt>TApplication</tt> instance. The <tt>PropertyName="PropertyValue"</tt> pairs specify the initial values for the properties of <tt>TApplication</tt>.</li>
<li>The <tt><paths></tt> element contains the definition of path aliases and the PHP inclusion paths for the application. Each path alias is specified via an <tt><alias></tt> whose <tt>path</tt> attribute takes an absolute path or a path relative to the directory containing the application configuration file. The <tt><using></tt> element specifies a particular path (in terms of namespace) to be appended to the PHP include paths when the application runs. PRADO defines two default aliases: <tt>System</tt> and <tt>Application</tt>. The former refers to the PRADO framework root directory, and the latter refers to the directory containing the application configuration file.</li>
<li>The <tt><modules></tt> element contains the configurations for a list of modules. Each module is specified by a <tt><module></tt> element. Each module is uniquely identified by the <tt>id</tt> attribute and is of type <tt>class</tt>. The <tt>PropertyName="PropertyValue"</tt> pairs specify the initial values for the properties of the module.</li>
<li>The <tt><services></tt> element is similar to the <tt><modules></tt> element. It mainly specifies the services provided by the application.</li>
<li>The <tt><parameters></tt> element contains a list of application-level parameters that are accessible from anywhere in the application. You may specify component-typed parameters like specifying modules, or you may specify string-typed parameters which take a simpler format as follows,
-<com:TTextHighlighter Language="xml" CssClass="source">
+<com:TTextHighlighter Language="xml" CssClass="source block-content" id="code_210096">
<parameter id="ParameterID" value="ParameterValue" />
</com:TTextHighlighter>
Note, if the <tt>value</tt> attribute is not specified, the whole parameter XML node (of type <tt>TXmlElement</tt>) will be returned as the parameter value. In addition, the <tt>System.Util.TParameterModule</tt> module provides a way to load parameters from an external XML file. See more details in its API documentation.
</li>
</ul>
-<p>
+<p id="210215" class="block-content">
Complete specification of application configurations can be found in the <a href="<%~../../../../../docs/specs/application.dtd%>">DTD</a> and <a href="<%~../../../../../docs/specs/application.xsd%>">XSD</a> files.
</p>
-<p>
+<p id="210216" class="block-content">
By default without explicit configuration, a PRADO application when running will load a few core modules, such as <tt>THttpRequest</tt>, <tt>THttpResponse</tt>, etc. It will also provide the <tt>TPageService</tt> as a default service. Configuration and usage of these modules and services are covered in individual sections of this tutorial. Note, if your application takes default settings for these modules and service, you do not need to provide an application configuration. However, if these modules or services are not sufficient, or you want to change their behavior by configuring their property values, you will need an application configuration.
</p>
diff --git a/demos/quickstart/protected/pages/Configurations/Overview.page b/demos/quickstart/protected/pages/Configurations/Overview.page index ec606941..07167fc6 100644 --- a/demos/quickstart/protected/pages/Configurations/Overview.page +++ b/demos/quickstart/protected/pages/Configurations/Overview.page @@ -1,9 +1,9 @@ <com:TContent ID="body" >
<h1 id="1401">Configuration Overview</h1>
-<p>
+<p id="170164" class="block-content">
PRADO uses configurations to glue together components into pages and applications. There are <a href="?page=Configurations.AppConfig">application configurations</a>, <a href="?page=Configurations.PageConfig">page configurations</a>, and <a href="?page=Configurations.Templates1">templates</a>.
</p>
-<p>
+<p id="170165" class="block-content">
Application and page configurations are optional if default values are used. Templates are mainly used by pages and template controls. They are optional, too.
</p>
diff --git a/demos/quickstart/protected/pages/Configurations/PageConfig.page b/demos/quickstart/protected/pages/Configurations/PageConfig.page index b0ef5ccb..f770dba2 100644 --- a/demos/quickstart/protected/pages/Configurations/PageConfig.page +++ b/demos/quickstart/protected/pages/Configurations/PageConfig.page @@ -1,16 +1,16 @@ <com:TContent ID="body" >
<h1 id="1901">Page Configurations</h1>
-<p>
+<p id="220217" class="block-content">
Page configurations are mainly used by <tt>TPageService</tt> to modify or append the application configuration. As the name indicates, a page configuration is associated with a directory storing some page files. It is stored as an XML file named <tt>config.xml</tt>.
</p>
-<p>
+<p id="220218" class="block-content">
When a user requests a page stored under <tt><BasePath>/dir1/dir2</tt>, the <tt>TPageService</tt> will try to parse and load <tt>config.xml</tt> files under <tt><BasePath></tt>, <tt><BasePath>/dir1</tt> and <tt><BasePath>/dir1/dir2</tt>. Paths, modules, and parameters specified in these configuration files will be appended or merged into the existing application configuration. Here <tt><BasePath></tt> is as defined in <a href="?page=Fundamentals.Services">page service</a>.
</p>
-<p>
+<p id="220219" class="block-content">
The format of a page configuration file is as follows,
</p>
-<com:TTextHighlighter Language="xml" CssClass="source">
+<com:TTextHighlighter Language="xml" CssClass="source block-content" id="code_220097">
<configuration>
<paths>
<alias id="AliasID" path="AliasPath" />
@@ -31,10 +31,10 @@ The format of a page configuration file is as follows, </parameters>
</configuration>
</com:TTextHighlighter>
-<p>
+<p id="220220" class="block-content">
The <tt><paths></tt>, <tt><modules></tt> and <tt><parameters></tt> are similar to those in an application configuration. The <tt><authorization></tt> specifies the authorization rules that apply to the current page directory and all its subdirectories. It will be explained in more detail in future sections. The <tt><pages></tt> element specifies the initial values for the properties of pages. Each <tt><page></tt> element specifies the initial property values for a particular page identified by the <tt>id</tt> attribute. Initial property values given in the <tt><pages></tt> element apply to all pages in the current directory and all its subdirectories.
</p>
-<p>
+<p id="220221" class="block-content">
Complete specification of page configurations can be found in the <a href="<%~../../../../../docs/specs/config.dtd%>">DTD</a> and <a href="<%~../../../../../docs/specs/config.xsd%>">XSD</a> files.
</p>
diff --git a/demos/quickstart/protected/pages/Configurations/Templates1.page b/demos/quickstart/protected/pages/Configurations/Templates1.page index cda02d2b..566a36b3 100644 --- a/demos/quickstart/protected/pages/Configurations/Templates1.page +++ b/demos/quickstart/protected/pages/Configurations/Templates1.page @@ -1,41 +1,41 @@ <com:TContent ID="body" >
<h1 id="1501">Templates: Part I</h1>
-<p>
+<p id="180166" class="block-content">
Templates are used to specify the presentational layout of controls. A template can contain static text, components, or controls that contribute to the ultimate presentation of the associated control. By default, an instance of <tt>TTemplateControl</tt> or its subclass may automatically load and instantiate a template from a file whose name is the same as the control class name. For page templates, the file name suffix must be <tt>.page</tt>; for other regular template controls, the suffix is <tt>.tpl</tt>.
</p>
-<p>The template format is like HTML, with a few PRADO-specifc tags, including <a href="#ct">component tags</a>, <a href="#tct">template control tags</a>, <a href="#cot">comment tags</a>, <a href="?page=Configurations.Templates2#dct">dynamic content tags</a>, and <a href="?page=Configurations.Templates3#dpt">dynamic property tags</a>. .
+<p id="180167" class="block-content">The template format is like HTML, with a few PRADO-specifc tags, including <a href="#ct">component tags</a>, <a href="#tct">template control tags</a>, <a href="#cot">comment tags</a>, <a href="?page=Configurations.Templates2#dct">dynamic content tags</a>, and <a href="?page=Configurations.Templates3#dpt">dynamic property tags</a>. .
</p>
<a name="ct"></a>
<h2 id="1502">Component Tags</h2>
-<p>
+<p id="180168" class="block-content">
A component tag specifies a component as part of the body content of the template control. If the component is a control, it usually will become a child or grand child of the template control, and its rendering result will be inserted at the place where it is appearing in the template.
</p>
-<p>
+<p id="180169" class="block-content">
The format of a component tag is as follows,
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_180072">
<com:ComponentType PropertyName="PropertyValue" ... EventName="EventHandler" ...>
body content
</com:ComponentType>
</com:TTextHighlighter>
<tt>ComponentType</tt> can be either the class name or the dotted type name (e.g. <tt>System.Web.UI.TControl</tt>) of the component. <tt>PropertyName</tt> and <tt>EventName</tt> are both case-insensitive. <tt>PropertyName</tt> can be a property or subproperty name (e.g. <tt>Font.Name</tt>). Note, <tt>PropertyValue</tt> will be HTML-decoded when assigned to the corresponding property. Content enclosed between the opening and closing component tag are normally treated the body of the component.
</p>
-<p>
+<p id="180170" class="block-content">
It is required that component tags nest properly with each other and an opening component tag be paired with a closing tag, similar to that in XML.
</p>
-<p>
+<p id="180171" class="block-content">
The following template shows a component tag specifying the <tt>Text</tt> property and <tt>OnClick</tt> event of a button control,
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_180073">
<com:TButton Text="Register" OnClick="registerUser" />
</com:TTextHighlighter>
Note, property names and event names are all case-insensitive, while component type names are case-sensitive. Event names always begin with <tt>On</tt>.
</p>
-<p>
+<p id="180172" class="block-content">
Also note, initial values for properties whose name ends with <tt>Template</tt> are specially processed. In particular, the initial values are parsed as <tt>TTemplate</tt> objects. The <tt>ItemTemplate</tt> property of the <tt>TRepeater</tt> control is such an example.
</p>
-<p>
+<p id="180173" class="block-content">
To deal conveniently with properties taking take big trunk of initial data, the following property initialization tag is introduced,
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_180074">
<prop:PropertyName>
PropertyValue
</prop:PropertyName>
@@ -44,9 +44,9 @@ It is equivalent to <tt>...PropertyName="PropertyValue"...</tt> in every aspect. </p>
<h3 id="1505">Component IDs</h3>
-<p>
+<p id="180174" class="block-content">
When specified in templates, component <tt>ID</tt> property has special meaning in addition to its normal property definition. A component tag specified with an ID value in template will register the corresponding component to the template owner control. The component can thus be directly accessed from the template control with its ID value. For example, in <tt>Home</tt> page's template, the following component tag
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_180075">
<com:TTextBox ID="TextBox" Text="First Name" />
</com:TTextHighlighter>
makes it possible to get the textbox object in code using <tt>$page->TextBox</tt>.
@@ -55,24 +55,24 @@ makes it possible to get the textbox object in code using <tt>$page->TextBox</tt <a name="tct"></a>
<h2 id="1503">Template Control Tags</h2>
A template control tag is used to configure the initial property values of the control owning the template. Its format is as follows,
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_180076">
<%@ PropertyName="PropertyValue" ... %>
</com:TTextHighlighter>
Like in component tags, <tt>PropertyName</tt> is case-insensitive and can be a property or subproperty name.
</p>
-<p>
+<p id="180175" class="block-content">
Initial values specified via the template control tag are assigned to the corresponding properties when the template control is being constructed. Therefore, you may override these property values in a later stage, such as the <tt>Init</tt> stage of the control.
</p>
-<p>
+<p id="180176" class="block-content">
Template control tag is optional in a template. Each template can contain at most one template control tag. You can place the template control tag anywhere in the template. It is recommended that you place it at the beginning of the template for better visibility.
</p>
<a name="cot"></a>
<h2 id="1504">Comment Tags</h2>
-<p>
+<p id="180177" class="block-content">
Comment tags are used to put in a template developer comments that will not display to end-users. Contents enclosed within a comment tag will be treated as raw text strings and PRADO will not attempt to parse them. Comment tags cannot be used within property values. The format of comment tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_180077">
<!--
Comments INVISIBLE to end-users
--->
@@ -81,17 +81,17 @@ Comments INVISIBLE to end-users The new comment tag <tt><!-- ... ---></tt> has been introduced since PRADO version 3.1. Previously, it was <tt><!-- ... --!></tt> which was deprecated because some editors have problems in syntax-highlighting such tags. </div>
<h2 id="1601">Include Tags</h2>
-<p>
+<p id="180178" class="block-content">
Since version 3.0.5, PRADO starts to support external template inclusion. This is accomplished via include tags, where external template files are specified in namespace format and their file name must be terminated as <tt>.tpl</tt>.
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_180078">
<%include path.to.templateFile %>
</com:TTextHighlighter>
-<p>
+<p id="180179" class="block-content">
External templates will be inserted at the places where the include tags occur in the base template.
</p>
-<p>
+<p id="180180" class="block-content">
Note, nested template inclusion is not supported, i.e., you cannot have include tags in an external template.
</p>
diff --git a/demos/quickstart/protected/pages/Configurations/Templates2.page b/demos/quickstart/protected/pages/Configurations/Templates2.page index 201c526f..e7cb46f5 100644 --- a/demos/quickstart/protected/pages/Configurations/Templates2.page +++ b/demos/quickstart/protected/pages/Configurations/Templates2.page @@ -3,42 +3,42 @@ <a name="dct"></a>
<h2 id="1602">Dynamic Content Tags</h2>
-<p>
+<p id="190181" class="block-content">
Dynamic content tags are introduced as shortcuts to some commonly used <a href="?page=Configurations.Templates1#ct">component tags</a>. These tags are mainly used to render contents resulted from evaluating some PHP expressions or statements. They include <a href="#et">expression tags</a>, <a href="#st">statement tags</a>, <a href="#dt">databind tags</a>, <a href="#pt">parameter tags</a>, <a href="#at">asset tags</a> and <a href="#lot">localization tags</a>.
</p>
<a name="et"></a>
<h3 id="1603">Expression Tags</h3>
-<p>
+<p id="190182" class="block-content">
An expression tag represents a PHP expression that is evaluated when the template control is in <tt>PreRender</tt> stage. The expression evaluation result is inserted at the place where the tag resides in the template. The context (namely <tt>$this</tt>) of the expression is the control owning the template.
</p>
-<p>
+<p id="190183" class="block-content">
The format of an expression tag is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190079">
<%= PhpExpression %>
</com:TTextHighlighter>
-<p>
+<p id="190184" class="block-content">
For example, the following expression tag will display the current page title at the place,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190080">
<%= $this->Title %>
</com:TTextHighlighter>
<a name="st"></a>
<h3 id="1604">Statement Tags</h3>
-<p>
+<p id="190185" class="block-content">
Statement tags are similar to expression tags, except that statement tags contain PHP statements rather than expressions. The output of the PHP statements (using for example <tt>echo</tt> or <tt>print</tt> in PHP) are displayed at the place where the statement tag resides in the template. The context (namely <tt>$this</tt>) of the statements is the control owning the template. The format of statement tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190081">
<%%
PHP Statements
%>
</com:TTextHighlighter>
-<p>
+<p id="190186" class="block-content">
The following example displays the current time in Dutch at the place,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190082">
<%%
setlocale(LC_ALL, 'nl_NL');
echo strftime("%A %e %B %Y",time());
@@ -47,52 +47,52 @@ echo strftime("%A %e %B %Y",time()); <a name="dt"></a>
<h3 id="1605">Databind Tags</h3>
-<p>
+<p id="190187" class="block-content">
Databind tags are similar to expression tags, except that the expressions are evaluated only when a <tt>dataBind()</tt> call is invoked on the controls representing the databind tags. The context (namely <tt>$this</tt>) of a databind expression is the control owning the template. The format of databind tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190083">
<%# PhpExpression %>
</com:TTextHighlighter>
<a name="pt"></a>
<h3 id="1606">Parameter Tags</h3>
-<p>
+<p id="190188" class="block-content">
Parameter tags are used to insert application parameters at the place where they appear in the template. The format of parameter tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190084">
<%$ ParameterName %>
</com:TTextHighlighter>
-<p>
+<p id="190189" class="block-content">
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"></a>
<h3 id="1607">Asset Tags</h3>
-<p>
+<p id="190190" class="block-content">
Asset tags are used to publish private files and display the corresponding the URLs. 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>
+<p id="190191" class="block-content">
The format of asset tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190085">
<%~ LocalFileName %>
</com:TTextHighlighter>
-<p>
+<p id="190192" class="block-content">
where <tt>LocalFileName</tt> 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>
+<p id="190193" class="block-content">
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>
<a name="lot"></a>
<h3 id="1608">Localization Tags</h3>
-<p>
+<p id="190194" class="block-content">
Localization tags represent localized texts. They are in the following format,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190086">
<%[string]%>
</com:TTextHighlighter>
-<p>
+<p id="190195" class="block-content">
where <tt>string</tt> will be translated to different languages according to the end-user's language preference. Localization tags are in fact shortcuts to the function call <tt>Prado::localize(string)</tt>.
</p>
diff --git a/demos/quickstart/protected/pages/Configurations/Templates3.page b/demos/quickstart/protected/pages/Configurations/Templates3.page index bc3b1f87..38391e9c 100644 --- a/demos/quickstart/protected/pages/Configurations/Templates3.page +++ b/demos/quickstart/protected/pages/Configurations/Templates3.page @@ -3,51 +3,51 @@ <a name="dpt"></a>
<h2 id="1702">Dynamic Property Tags</h2>
-<p>
+<p id="200196" class="block-content">
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,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200087">
<com:ComponentType PropertyName=DynamicPropertyTag ...>
body content
</com:ComponentType>
</com:TTextHighlighter>
-<p>
+<p id="200197" class="block-content">
where you may enclose <tt>DynamicPropertyTag</tt> within single or double quotes for better readability.
</p>
-<p>
+<p id="200198" class="block-content">
Like dynamic content tags, we have <a href="#et">expression tags</a>, <a href="#dt">databind tags</a>, <a href="#pt">parameter tags</a>, <a href="#at">asset tags</a> and <a href="#lot">localization tags</a>. (Note, there is no statement tag here.)
</p>
<a name="et"></a>
<h3 id="1703">Expression Tags</h3>
-<p>
+<p id="200199" class="block-content">
An expression tag represents a PHP expression that is evaluated when the control is in <tt>PreRender</tt> stage. The expression evaluation result is assigned to the corresponding component property. The format of expression tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200088">
<%= PhpExpression %>
</com:TTextHighlighter>
-<p>
+<p id="200200" class="block-content">
In the expression, <tt>$this</tt> refers to the control owning the template. The following example specifies a <tt>TLabel</tt> control whose <tt>Text</tt> property is initialized as the current page title when the <tt>TLabel</tt> control is being constructed,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200089">
<com:TLabel Text=<%= $this->Page->Title %> />
</com:TTextHighlighter>
<a name="dt"></a>
<h3 id="1704">Databind Tags</h3>
-<p>
+<p id="200201" class="block-content">
Databind tags are similar to expression tags, except that they can only be used with control properties and the expressions are evaluated only when a <tt>dataBind()</tt> call is invoked on the controls represented by the component tags. In the expression, <tt>$this</tt> refers to the control owning the template. Databind tags do not apply to all components. They can only be used for controls.
</p>
-<p>
+<p id="200202" class="block-content">
The format of databind tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200090">
<%# PhpExpression %>
</com:TTextHighlighter>
-<p>
+<p id="200203" class="block-content">
Since v3.0.2, expression tags and databind tags can be embedded within static strings. For example, you can write the following in a template,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200091">
<com:TLabel>
<prop:Text>
Today is <%= date('F d, Y',time()) >.
@@ -55,49 +55,49 @@ Since v3.0.2, expression tags and databind tags can be embedded within static st </prop:Text>
</com:TLabel>
</com:TTextHighlighter>
-<p>
+<p id="200204" class="block-content">
Previously, you would have to use a single expression with string concatenations to achieve the same effect.
</p>
<a name="pt"></a>
<h3 id="1705">Parameter Tags</h3>
-<p>
+<p id="200205" class="block-content">
Parameter tags are used to assign application parameter values to the corresponding component properties. The format of parameter tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200092">
<%$ ParameterName %>
</com:TTextHighlighter>
-<p>
+<p id="200206" class="block-content">
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"></a>
<h3 id="1706">Asset Tags</h3>
-<p>
+<p id="200207" class="block-content">
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. The asset tags are evaluated when the template is instantiated.
</p>
-<p>
+<p id="200208" class="block-content">
The format of asset tags is as follows,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200093">
<%~ LocalFileName %>
</com:TTextHighlighter>
-<p>
+<p id="200209" class="block-content">
where <tt>LocalFileName</tt> 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>
+<p id="200210" class="block-content">
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>
<a name="lot"></a>
<h3 id="1707">Localization Tags</h3>
-<p>
+<p id="200211" class="block-content">
Localization tags represent localized texts. They are in the following format,
</p>
-<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_200094">
<%[string]%>
</com:TTextHighlighter>
-<p>
+<p id="200212" class="block-content">
where <tt>string</tt> will be translated to different languages according to the end-user's language preference. The localization tags are evaluated when the template is instantiated. Localization tags are in fact shortcuts to the function call <tt>Prado::localize(string)</tt>.
</p>
diff --git a/demos/quickstart/protected/pages/Configurations/UrlMapping.page b/demos/quickstart/protected/pages/Configurations/UrlMapping.page index 20954c24..a8ea3ace 100644 --- a/demos/quickstart/protected/pages/Configurations/UrlMapping.page +++ b/demos/quickstart/protected/pages/Configurations/UrlMapping.page @@ -4,12 +4,12 @@ <com:DocLink ClassPath="System.Web.TUrlMapping" />
-<p>Using the <tt>TUrlMapping</tt> module different URLs can be
+<p id="230222" class="block-content">Using the <tt>TUrlMapping</tt> module different URLs can be
mapped into any existing Prado pages or services. This allows
the application to use nice looking and friendly URLs.
</p>
-<p>
+<p id="230223" class="block-content">
The <tt>TUrlMapping</tt> module allows aributary URL path to be mapped to a
particular service and page class. This module must be configured
before a service is initialized, thus this module should be configured
@@ -25,9 +25,9 @@ This usually means delcaring the <tt>TUrlMapping</tt> module before any Specifying the mappings in the per directory <tt>config.xml</tt> is not supported.
</div>
-<p>
+<p id="230224" class="block-content">
To use <tt>TUrlMapping</tt>, one must set the <tt>UrlManager</tt> property of the <tt>THttpRequest</tt> module as the <tt>TUrlMapping</tt> module ID. See following for an example,
-<com:TTextHighlighter Language="xml" CssClass="source">
+<com:TTextHighlighter Language="xml" CssClass="source block-content" id="code_230098">
<modules>
<module id="request" class="THttpRequest" UrlManager="friendly-url" />
<module id="friendly-url" class="System.Web.TUrlMapping">
@@ -39,25 +39,25 @@ To use <tt>TUrlMapping</tt>, one must set the <tt>UrlManager</tt> property of th </com:TTextHighlighter>
</p>
-<p>
+<p id="230225" class="block-content">
The above example is part of the application configuration of the <tt>blog</tt> demo in the PRADO release. It enables recognition of the following URL formats:
</p>
-<ul>
+<ul id="u1" class="block-content">
<li><tt>/index.php/post/123</tt> is recognized as <tt>/index.php?page=Posts.ViewPost&id=123</tt></li>
<li><tt>/index.php/archive/200605</tt> is recognized as <tt>/index.php?page=Posts.ListPost&time=200605</tt></li>
<li><tt>/index.php/category/2</tt> is recognized as <tt>/index.php?page=Posts.ListPost&cat=2</tt></li>
</ul>
-<p>
+<p id="230226" class="block-content">
The <tt>ServiceParameter</tt> and <tt>ServiceID</tt> (the default ID is 'page') set the service parameter and service ID, respectively, of the <a href="?page=Fundamentals.Modules">Request module</a>. The service parameter for the <tt>TPageService</tt> service is the Page class name, e.g., for an URL "index.php?page=Home", "page" is the service ID and the service parameter is "Home". Other services may use the service parameter and ID differently. See <a href="?page=Fundamentals.Services">Services</a> for further details.
</p>
-<h2>Specifying URL Patterns</h2>
-<p>
+<h2 id="46023">Specifying URL Patterns</h2>
+<p id="230227" class="block-content">
<tt>TUrlMapping</tt> enables recognition of customized URL formats based on a list prespecified of URL patterns. Each pattern is specified in a <tt><url></tt> tag.
</p>
-<p>
+<p id="230228" class="block-content">
The <tt>Pattern</tt> and <tt>Parameters</tt> attribute
values are regular expression patterns that
determine the mapping criteria. The <tt>Pattern</tt> property takes
@@ -65,20 +65,20 @@ a regular expression with parameter names enclosed between a left brace '<tt>{</ and a right brace '<tt>}</tt>'. The pattens for each parameter can be set
using <tt>Parameters</tt>attribute collection.
For example,
-<com:TTextHighlighter Language="xml" CssClass="source">
+<com:TTextHighlighter Language="xml" CssClass="source block-content" id="code_230099">
<url ServiceParameter="ArticleView" pattern="articles/{year}/{month}/{day}"
parameters.year="\d{4}" parameters.month="\d{2}" parameters.day="\d+" />
</com:TTextHighlighter>
</p>
The example is equivalent to the following regular expression (it uses the "named group" feature in regular expressions available in PHP):
-<com:TTextHighlighter Language="xml" CssClass="source">
+<com:TTextHighlighter Language="xml" CssClass="source block-content" id="code_230100">
<url ServiceParmaeter="ArticleView">
<![CDATA[
/articles\/(?P<year>\d{4})\/(?P<month>\d{2})\/(?P<day>\d+)/u
]]>
</url>
</com:TTextHighlighter>
-<p>
+<p id="230229" class="block-content">
In the above example, the pattern contains 3 parameters named "<tt>year</tt>",
"<tt>month</tt>" and "<tt>day</tt>". The pattern for these parameters are,
respectively, "<tt>\d{4}</tt>" (4 digits), "<tt>\d{2}</tt>" (2 digits)
@@ -92,7 +92,7 @@ to form a complete regular expression string. property you need to escape the slash in regular expressions.
</div>
-<p>Following from the above pattern example,
+<p id="230230" class="block-content">Following from the above pattern example,
an URL "<tt>http://example.com/index.php/articles/2006/07/21</tt>" will be matched
and valid. However, "<tt>http://example.com/index.php/articles/2006/07/hello</tt>" is not
valid since the "<tt>day</tt>" parameter pattern is not satisfied.
@@ -101,19 +101,19 @@ and valid. However, "<tt>http://example.com/index.php/articles/2006/07/hello</t "<tt>/index.php/articles/2006/07/21</tt>" portion of the URL is considered.
</p>
-<p>
+<p id="230231" class="block-content">
The mapped request URL is equivalent to <tt>index.php?page=ArticleView&year=2006&month=07&day=21</tt>.
The request parameter values are available through the standard <tt>Request</tt>
object. For example, <tt>$this->Request['year']</tt>.
</p>
-<p>The URL mapping are evaluated in order they are place and only the first mapping that matches
+<p id="230232" class="block-content">The URL mapping are evaluated in order they are place and only the first mapping that matches
the URL will be used. Cascaded mapping can be achieved by placing the URL mappings
in particular order. For example, placing the most specific mappings first.
</p>
-<h2>Constructing Customized URLs</h2>
-<p>
+<h2 id="46024">Constructing Customized URLs</h2>
+<p id="230233" class="block-content">
Since version 3.0.6, <tt>TUrlMapping</tt> starts to support constructing customized URL formats. This is achieved by allowing users to extend <tt>TUrlMapping</tt> class and override the <tt>constructUrl</tt> method. In the applications, users can still use <tt>THttpRequest.constructUrl()</tt> or <tt>TPageService.constructUrl()</tt> to generate PRADO-recognizable URLS. The actual URL construction work is ultimately delegated to the <tt>TUrlMapping.constructUrl()</tt>, provided it is implemented.
</p>
|