From 36a61db3144c111b722db89baf5a1d55c1c9a6b2 Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 28 Sep 2006 00:11:36 +0000 Subject: Update TUrlMapping and THttpRequest --- .../quickstart/protected/pages/Advanced/Error.page | 6 ++-- .../protected/pages/Advanced/MasterContent.page | 2 +- .../protected/pages/Configurations/Templates1.page | 2 +- .../protected/pages/Configurations/UrlMapping.page | 41 +++++++++++++++------- .../protected/pages/Controls/Validation.page | 4 +-- .../pages/GettingStarted/CommandLine.page | 10 +++--- 6 files changed, 41 insertions(+), 24 deletions(-) (limited to 'demos/quickstart') diff --git a/demos/quickstart/protected/pages/Advanced/Error.page b/demos/quickstart/protected/pages/Advanced/Error.page index a0765c10..9d2cf9ec 100644 --- a/demos/quickstart/protected/pages/Advanced/Error.page +++ b/demos/quickstart/protected/pages/Advanced/Error.page @@ -70,8 +70,8 @@ The naming convention for the template files used for all other exceptions is as

Again, if the preferred language is not found, PRADO will try to use exception.html, instead.

-

-CAUTION: When saving a template file, please make sure the file is saved using UTF-8 encoding. On Windows, you may use Notepad.exe to accomplish such saving. -

+
+CAUTION: When saving a template file, please make sure the file is saved using UTF-8 encoding. On Windows, you may use Notepad.exe to accomplish such saving. +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/MasterContent.page b/demos/quickstart/protected/pages/Advanced/MasterContent.page index b7bcc9bb..b0836393 100644 --- a/demos/quickstart/protected/pages/Advanced/MasterContent.page +++ b/demos/quickstart/protected/pages/Advanced/MasterContent.page @@ -40,7 +40,7 @@ Then, the contents are inserted into the master control according to the followi alt="Master and Content" /> alt="Parent-child relationship between master and content" /> -

Master vs. External Template

+

Master vs. External Template

Master is very similar to external templates which are introduced since version 3.0.5. A special include tag is used to include an external template file into a base template.

diff --git a/demos/quickstart/protected/pages/Configurations/Templates1.page b/demos/quickstart/protected/pages/Configurations/Templates1.page index 7acd92d0..958e27cf 100644 --- a/demos/quickstart/protected/pages/Configurations/Templates1.page +++ b/demos/quickstart/protected/pages/Configurations/Templates1.page @@ -85,7 +85,7 @@ Comments INVISIBLE to end-users Note, template comments (by <!-- ... --!>) cannot appear in a property value.

-

Include Tags

+

Include Tags

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

diff --git a/demos/quickstart/protected/pages/Configurations/UrlMapping.page b/demos/quickstart/protected/pages/Configurations/UrlMapping.page index dde6854f..ff6f09c7 100644 --- a/demos/quickstart/protected/pages/Configurations/UrlMapping.page +++ b/demos/quickstart/protected/pages/Configurations/UrlMapping.page @@ -1,6 +1,6 @@ -

URL Mapping (Friendly URLs)

+

URL Mapping (Friendly URLs)

@@ -17,16 +17,25 @@ globally in the application configurati file and before any services.

+
Info: +The TUrlMapping must be configured before the +Request module resolves the request. +This usually means delcaring the TUrlMapping module before any +<services> tag in the application configuration. +Specifying the mappings in the per directory config.xml is not supported. +
+

The mapping format is as follows. - +

The ServiceParameter and ServiceID - (the default ID is 'page') set the service parameter and service ID respectively. + (the default ID is 'page') set the service parameter and service ID, respectively, of + the Request module. The service parameter for the TPageService 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. @@ -42,15 +51,15 @@ and a right brace '}'. The pattens for each parameter can be set using Parametersattribute collection. For example, -

-The example is equivalent, using regular expression only, to +The example is equivalent to the following regular expression (it uses the "named group" feature in regular expressions available in PHP): - + \d{4})/(?P\d{2})/(?P\d+) + /articles\/(?P\d{4})\/(?P\d{2})\/(?P\d+)/u ]]> @@ -59,19 +68,27 @@ In the above example, the pattern contains 3 parameters named "year", "month" and "day". The pattern for these parameters are, respectively, "\d{4}" (4 digits), "\d{2}" (2 digits) and "\d+" (1 or more digits). +Essentially, the Parameters attribute name and values are used + as substrings in replacing the placeholders in the Pattern string +to form a complete regular expression string.

-

For example, an URL "http://example.com/index.php/articles/2006/07/21" will be matched +

Note: If you intended to use the RegularExpression +property you need to escape the slash in regular expressions. +
+ +

Following from the above pattern example, +an URL "http://example.com/index.php/articles/2006/07/21" will be matched and valid. However, "http://example.com/index.php/articles/2006/07/hello" is not valid since the "day" parameter pattern is not satisfied. In the default TUrlMappingPattern class, the pattern is matched against the path property of the URL only. For example, only the -"/index.php/articles/2006/07/21" portion of the URL is considered and the rest -is ignored. +"/index.php/articles/2006/07/21" portion of the URL is considered.

- -

The parameter values are available through the standard Request +

+The mapped request URL is equivalent to index.php?page=ArticleView&year=2006&month=07&day=21. +The request parameter values are available through the standard Request object. For example, $this->Request['year'].

diff --git a/demos/quickstart/protected/pages/Controls/Validation.page b/demos/quickstart/protected/pages/Controls/Validation.page index 119749db..2405fb45 100644 --- a/demos/quickstart/protected/pages/Controls/Validation.page +++ b/demos/quickstart/protected/pages/Controls/Validation.page @@ -151,7 +151,7 @@ The summary can be displayed as a list, a bulleted list, or a single paragraph b

-

Client and Server Side Conditional Validation

+

Client and Server Side Conditional Validation

All validators contains the following events.

    @@ -180,7 +180,7 @@ function onErrorHandler(sender, parameter) Where sender is the current client-side validator and parameter is the control that invoked the validator.

    -

    Conditional Validation Example

    +

    Conditional Validation Example

    The following example show the use of client-side and server side validator events. The example demonstrates conditional validation. diff --git a/demos/quickstart/protected/pages/GettingStarted/CommandLine.page b/demos/quickstart/protected/pages/GettingStarted/CommandLine.page index c2050246..cf204a40 100644 --- a/demos/quickstart/protected/pages/GettingStarted/CommandLine.page +++ b/demos/quickstart/protected/pages/GettingStarted/CommandLine.page @@ -1,18 +1,18 @@ -

    Command Line Tool

    +

    Command Line Tool

    The optional prado-cli.php PHP script file in the framework directory provides command line tools to perform various tendious taks in Prado. The prado-cli.php can be used to create Prado project skeletons, create initial test fixtures, and access to an interactive PHP shell.

    -

    Requirements

    +

    Requirements

    To use the command line tool, you need to use your command prompt, command console or terminal. In addition, PHP must be able to execute PHP scripts from the command line.

    -

    Usage

    +

    Usage

    If you type php path/to/framework/prado-cli.php, you should see the following information. Alternatively, if you are not on Windows, @@ -38,7 +38,7 @@ actions:

    The <parameter> are required parameters and [optional] are optional parameters.

    -

    Creating a new Prado project skeleton

    +

    Creating a new Prado project skeleton

    To create a Prado project skeleton, do the following:

      @@ -49,7 +49,7 @@ are optional parameters.

      the test fixtures for the helloworld project.
    -

    Interactive Shell

    +

    Interactive Shell

    The interactive shell allows you to evaluate PHP statements from te command line. The prado-cli.php script can be used to start the shell and load an existing -- cgit v1.2.3