diff options
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Configurations/AppConfig.page | 4 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Fundamentals/Applications.page | 41 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Fundamentals/Services.page | 14 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Fundamentals/applifecycles.gif | bin | 0 -> 34714 bytes | |||
-rw-r--r-- | demos/quickstart/protected/pages/Fundamentals/applifecycles.vsd | bin | 0 -> 216576 bytes | |||
-rw-r--r-- | demos/quickstart/themes/Simple/style.css | 3 | ||||
-rw-r--r-- | framework/Web/Services/TPageService.php | 5 |
8 files changed, 58 insertions, 11 deletions
diff --git a/.gitattributes b/.gitattributes index 77a53a93..427287dc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,6 +29,8 @@ demos/quickstart/protected/pages/Fundamentals/Controls.page -text demos/quickstart/protected/pages/Fundamentals/Modules.page -text demos/quickstart/protected/pages/Fundamentals/Pages.page -text demos/quickstart/protected/pages/Fundamentals/Services.page -text +demos/quickstart/protected/pages/Fundamentals/applifecycles.gif -text +demos/quickstart/protected/pages/Fundamentals/applifecycles.vsd -text demos/quickstart/protected/pages/Fundamentals/lifecycles.gif -text demos/quickstart/protected/pages/Fundamentals/lifecycles.vsd -text demos/quickstart/protected/pages/GettingStarted/AboutPrado.page -text diff --git a/demos/quickstart/protected/pages/Configurations/AppConfig.page b/demos/quickstart/protected/pages/Configurations/AppConfig.page index b6bf89f5..dc4675f1 100644 --- a/demos/quickstart/protected/pages/Configurations/AppConfig.page +++ b/demos/quickstart/protected/pages/Configurations/AppConfig.page @@ -2,10 +2,10 @@ <h1>Application Configurations</h1>
<p>
-Application configurations are used to specify the global behavior of an application. This consists of specifying the paths, modules, services and parameters that will be used in an application.
+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>
-Application configurations are stored in an XML file which is passed as a parameter to the <code>TApplication</code> instance. The format of application configurations is shown in the following,
+Configuration for an application is stored in an XML file named <code>application.xml</code>, which should be located under the application base path. Its format is shown in the following,
<pre class="source">
<application PropertyName="PropertyValue" ...>
<paths>
diff --git a/demos/quickstart/protected/pages/Fundamentals/Applications.page b/demos/quickstart/protected/pages/Fundamentals/Applications.page index 0a3028c5..c64a9ea4 100644 --- a/demos/quickstart/protected/pages/Fundamentals/Applications.page +++ b/demos/quickstart/protected/pages/Fundamentals/Applications.page @@ -2,13 +2,10 @@ <h1>Applications</h1>
<p>
-An application is an instance of <code>TApplication</code> or its derived class. Each PRADO application consists of a single application instance, one or several services, and some modules. For applications providing the page service (true for nearly all applications), they also contain one or several pages.
+An application is an instance of <code>TApplication</code> or its derived class. It manages modules that provide different functionalities and are loaded when needed. It provides services to end-users. It is the central place to store various parameters used in an application. In a PRADO application, the application instance is the only object that is globally accessible via <code>Prado::getApplication()</code> function call.
</p>
<p>
-The application instance is the only object that is accessible globally via <code>Prado::getApplication()</code> function call. It manages modules that provide different functionalities and are loaded when needed. It holds services that are available to end-users. An application instance may be configured via <a href="?page=Configurations.AppConfig">application configurations</a>.
-</p>
-<p>
-An application instance is usually created in an entry script in a PRADO application, as shown in the following,
+Applications are configured via <a href="?page=Configurations.AppConfig">application configurations</a>. They are usually created entry scripts like the following,
<pre class="source">
require_once('/path/to/prado.php');
$application = new TApplication;
@@ -17,9 +14,41 @@ $application->run(); where the method <code>run()</code> starts the application to handle user requests.
</p>
+<h2>Directory Organization</h2>
+<p>
+A minimal PRADO application contains two files: an entry file and a page template file. They must be organized as follows,
+<img src="<%~directory.gif%>" />
+<ul>
+<li><code>wwwroot</code> - Web document root or sub-directory.</li>
+<li><code>index.php</code> - entry script of the PRADO application.</li>
+<li><code>assets</code> - directory storing published private files. See <a href="?page=Advanced.Assets">assets</a> section.</li>
+<li><code>protected</code> - application base path storing application data and private script files. This directory should be configured inaccessible to Web-inaccessible, or it may be located outside of Web directories.</li>
+<li><code>runtime</code> - application runtime storage path. This directory is used by PRADO to store application runtime information, such as application state, cached data, etc.</li>
+<li><code>pages</code> - base path storing all PRADO pages. See <a href="?page=Fundamentals.Services">services</a> section.</li>
+<li><code>Home.page</code> - default page returned when users do not explicitly specify the page requested. This is a page template file. The file name without suffix is the page name. The page class is <code>TPage</code>. If there is also a class file <code>Home.php</code>, the page class becomes <code>Home</code>.</li>
+</ul>
+</p>
+<p>
+A product PRADO application usually needs more files. It may include an application configuration file named <code>application.xml</code> under the application base path <code>protected</code>. The pages may be organized in directories, some of which may contain page configuration files named <code>config.xml</code>. Fore more details, please see <a href="?page=Configurations.Overview">configurations</a> section.
+</p>
+
+<h2>Application Deployment</h2>
+<p>
+Deploying a PRADO application mainly involves copying directories. For example, to deploy the above minimal application to another server, follow the following steps,
+<ol>
+<li>Copy the content under <code>wwwroot</code> to a Web-accessible directory on the new server.</li>
+<li>Modify the entry script file <code>index.php</code> so that it includes correctly the <code>prado.php</code> file.</li>
+<li>Remove all content under <code>assets</code> and <code>runtime</code> directories and make sure both directories are writable by the Web server process.</li>
+</ol>
+</p>
+
<h2>Application Lifecycles</h2>
<p>
-TBD
+Like page lifecycles, an application also has lifecycles. Application modules can register for the lifecycle events. When the application reaches a particular lifecycle and raises the corresponding event, the registered module methods are invoked automatically. Modules included in the PRADO release, such as <code>TAuthManager</code>, are using this way to accomplish their goals.
+</p>
+<p>
+The application lifecycles can be depicted as follows,
</p>
+<img src="<%~applifecycles.gif%>" />
</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Services.page b/demos/quickstart/protected/pages/Fundamentals/Services.page index 0ed976c9..0cd7762c 100644 --- a/demos/quickstart/protected/pages/Fundamentals/Services.page +++ b/demos/quickstart/protected/pages/Fundamentals/Services.page @@ -16,7 +16,19 @@ Developers may implement additional services for their applications. To make a s <h2>Page Service</h2>
<p>
-PRADO implements <code>TPageService</code> to process users' page requests.
+PRADO implements <code>TPageService</code> to process users' page requests. Pages are stored under a directory specified by the <code>BasePath</code> property of the page service. The property defaults to <code>pages</code> directory under the application base path. You may change this default by configuring the service in the application configuration.
+</p>
+<p>
+Pages may be organized into subdirectories under the <code>BasePath</code>. In each directory, there may be a page configuration file named <code>config.xml</code>, which contains configurations effective only when a page under that directory or a sub-directory is requested. For more details, see the <a href="?page=Configurations.PageConfig">page configuration</a> section.
+</p>
+<p>
+Service parameter for the page service refers to the page being requested. A parameter like <code>Fundamentals.Services</code> refers to the <code>Services</code> page under the <code><BasePath>/Fundamentals</code> directory. If such a parameter is absent in a request, a default page named <code>Home</code> is assumed. Using <code>THttpRequest</code> as the request module (default), the following URLs will request for <code>Home</code>, <code>About</code> and <code>Register</code> pages, respectively,
+<pre class="source">
+http://hostname/index.php
+http://hostname/index.php?page=About
+http://hostname/index.php?page=Users.Register
+</pre>
+where the first example takes advantage of the fact that the page service is the default service and <code>Home</code> is the default page.
</p>
</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/applifecycles.gif b/demos/quickstart/protected/pages/Fundamentals/applifecycles.gif Binary files differnew file mode 100644 index 00000000..e4fc306c --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/applifecycles.gif diff --git a/demos/quickstart/protected/pages/Fundamentals/applifecycles.vsd b/demos/quickstart/protected/pages/Fundamentals/applifecycles.vsd Binary files differnew file mode 100644 index 00000000..0f0e2bab --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/applifecycles.vsd diff --git a/demos/quickstart/themes/Simple/style.css b/demos/quickstart/themes/Simple/style.css index cfad07d7..9b7ae2b2 100644 --- a/demos/quickstart/themes/Simple/style.css +++ b/demos/quickstart/themes/Simple/style.css @@ -8,7 +8,7 @@ body { }
h1 {
- font-size:14pt;
+ font-size:13pt;
}
h2 {
@@ -138,4 +138,5 @@ h3 { code {
font-family: "Courier New", Courier, mono;
+ color: #408040;
}
\ No newline at end of file diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index d94b7ae2..7ef3c4f0 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -26,13 +26,16 @@ Prado::using('System.Web.UI.TPageStatePersister'); *
* Pages that are available to client users are stored under a directory specified by
* {@link setBasePath BasePath}. The directory may contain subdirectories.
- * A directory may be used to group together the pages serving for the similar goal.
+ * Pages serving for a similar goal are usually placed under the same directory.
* A directory may contain a configuration file <b>config.xml</b> whose content
* is similar to that of application configuration file.
*
* A page is requested via page path, which is a dot-connected directory names
* appended by the page name. Assume '<BasePath>/Users/Admin' is the directory
* containing the page 'Update'. Then the page can be requested via 'Users.Admin.Update'.
+ * By default, the {@link setBasePath BasePath} of the page service is the "pages"
+ * directory under the application base path. You may change this default
+ * by setting {@link setBasePath BasePath} with a different path you prefer.
*
* Page name refers to the file name (without extension) of the page template.
* In order to differentiate from the common control template files, the extension
|