diff options
Diffstat (limited to 'demos/quickstart/protected')
4 files changed, 115 insertions, 11 deletions
diff --git a/demos/quickstart/protected/controls/TopicList.tpl b/demos/quickstart/protected/controls/TopicList.tpl index 26ef4294..c2a36390 100644 --- a/demos/quickstart/protected/controls/TopicList.tpl +++ b/demos/quickstart/protected/controls/TopicList.tpl @@ -63,9 +63,7 @@ <div class="topic">
<div>Security</div>
<ul>
- <li><a href="?page=Construction">Overview</a></li>
- <li><a href="?page=Construction">Authentication</a></li>
- <li><a href="?page=Construction">Authorization</a></li>
+ <li><a href="?page=Construction">Authentication and Authorization</a></li>
<li><a href="?page=Construction">ViewState Protection</a></li>
</ul>
</div>
@@ -76,6 +74,9 @@ <li><a href="?page=Advanced.Assets">Assets</a></li>
<li><a href="?page=Advanced.MasterContent">Master and Content</a></li>
<li><a href="?page=Advanced.Themes">Themes and Skins</a></li>
+ <li><a href="?page=Advanced.State">Persistent State</a></li>
+ <li><a href="?page=Advanced.Logging">Logging</a></li>
+ <li><a href="?page=Advanced.Error">Error Handling and Reporting</a></li>
<li><a href="?page=Advanced.I18N">Internationalization</a></li>
<li><a href="?page=Advanced.Performance">Performance Tuning</a></li>
</ul>
diff --git a/demos/quickstart/protected/pages/Advanced/Assets.page b/demos/quickstart/protected/pages/Advanced/Assets.page index 6460cb0a..ef4a1bf0 100644 --- a/demos/quickstart/protected/pages/Advanced/Assets.page +++ b/demos/quickstart/protected/pages/Advanced/Assets.page @@ -10,9 +10,6 @@ Because directories containing component class files are normally inaccessible b <h2>Asset Publishing</h2>
<p>
-Asset publishing is managed by the <tt>System.Web.UI.TAssetManager</tt> module. By default, all published asset files are stored under the <tt>[AppEntryPath]/assets</tt> directory, where <tt>AppEntryPath</tt> refers to the directory containing the application entry script. Make sure the <tt>assets</tt> directory is writable by the Web server process. You may change this directory to another by setting the <tt>BasePath</tt> and <tt>BaseUrl</tt> properties of the <tt>System.Web.UI.TAssetManager</tt> module.
-</p>
-<p>
PRADO provides several methods for publishing assets or directories containing assets:
</p>
<ul>
@@ -24,6 +21,21 @@ PRADO provides several methods for publishing assets or directories containing a BE AWARE: Be very careful with assets publishing, because it gives Web users access to files that were previously inaccessible to them. Make sure that you do not publish files that do not want Web users to see.
</p>
+<h2>Customization</h2>
+<p>
+Asset publishing is managed by the <tt>System.Web.UI.TAssetManager</tt> module. By default, all published asset files are stored under the <tt>[AppEntryPath]/assets</tt> directory, where <tt>AppEntryPath</tt> refers to the directory containing the application entry script. Make sure the <tt>assets</tt> directory is writable by the Web server process. You may change this directory to another by configuring the <tt>BasePath</tt> and <tt>BaseUrl</tt> properties of the <tt>System.Web.UI.TAssetManager</tt> module in application configuration,
+</p>
+<com:TTextHighlighter Language="xml" CssClass="source">
+<service id="page" class="TPageService">
+ <modules>
+ <module id="asset"
+ class="System.Web.UI.TAssetManager"
+ BasePath="images"
+ BaseUrl="images" />
+ </modules>
+</service>
+</com:TTextHighlighter>
+
<h2>Performance</h2>
<p>
PRADO uses caching techniques to ensure the efficiency of asset publishing. Publishing an asset essentially requires file copy operation, which is expensive. To save unnecessary file copy operations, <tt>System.Web.UI.TAssetManager</tt> only publishes an asset when it has a newer file modification time than the published file. When an application runs under the <tt>Performance</tt> mode, such timestamp checkings are also omitted.
diff --git a/demos/quickstart/protected/pages/Advanced/Performance.page b/demos/quickstart/protected/pages/Advanced/Performance.page index d1c5a49c..5aee4a9b 100644 --- a/demos/quickstart/protected/pages/Advanced/Performance.page +++ b/demos/quickstart/protected/pages/Advanced/Performance.page @@ -1,5 +1,82 @@ <com:TContent ID="body" >
<h1>Performance Tuning</h1>
+<p>
+Performance of Web applications is affected by many factors. Database access, file system operations, network bandwidth are all potential affecting factors. PRADO tries in every effort to reduce the performance impact caused by the framework.
+</p>
+
+<h2>Caching</h2>
+<p>
+PRADO provides a generic caching technique used by in several core parts of the framework. For example, when caching is enabled, <tt>TTemplateManager</tt> will save parsed templates in cache and reuse them in the following requests, which saves time for parsing templates. The <tt>TThemeManager</tt> adopts the similar strategy to deal with theme parsing.
+</p>
+<p>
+Enabling caching is very easy. Simply add the cache module in the application configuration, and PRADO takes care of the rest.
+</p>
+<com:TTextHighlighter Language="xml" CssClass="source">
+<modules>
+ <module id="cache" class="System.Data.TSqliteCache" />
+</modules>
+</com:TTextHighlighter>
+
+<p>
+Developers can also take advantage of the caching technique in their applications. The <tt>Cache</tt> property of <tt>TApplication</tt> returns the plugged-in cache module when it is available. To save and retrieve a data item in cache, use the following commands,
+</p>
+<com:TTextHighlighter CssClass="source">
+if($application->Cache) {
+ // saves data item in cache
+ $application->Cache->set($keyName,$dataItem);
+ // retrieves data item from cache
+ $dataItem=$application->Cache->get($keyName);
+}
+</com:TTextHighlighter>
+<p>
+where <tt>$keyName</tt> should be a string that uniquely identifies the data item stored in cache.
+</p>
+
+<h2>Using <tt>pradolite.php</tt></h2>
+<p>
+Including many PHP script files may impact application performance significantly. PRADO classes are stored in different files and when processing a page request, it may require including tens of class files.To alleviate this problem, in each PRADO release, a file named <tt>pradolite.php</tt> is also included. The file is a merge of all core PRADO class files whose comments are also stripped off.
+</p>
+<p>
+To use <tt>pradolite.php</tt>, in your application entry script, replace the inclusion of <tt>prado.php</tt> with <tt>pradolite.php</tt>.
+</p>
+
+<h2>Changing Application Mode</h2>
+<p>
+Application mode also affects application performance. A PRADO application can be in one of the following modes: <tt>Off</tt>, <tt>Debug</tt>, <tt>Normal</tt> and <tt>Performance</tt>. The <tt>Debug</tt> mode should mainly be used during application development, while <tt>Normal</tt> mode is usually used in early stage after an application is deployed to ensure everything works correctly. After the application is proved to work stably for some period, the mode can be switched to <tt>Performance</tt> to further improve the performance.
+</p>
+<p>
+The difference between <tt>Debug</tt>, <tt>Normal</tt> and <tt>Performance</tt> modes is that under <tt>Debug</tt> mode, application logs will contain debug information, and under <tt>Performance</tt> mode, timestamp checking is not performed for cached templates and published assets. Therefore, under <tt>Performance</tt> mode, application may not run properly if templates or assets are modified. Since <tt>Performance</tt> mode is mainly used when an application is stable, change of templates or assets are not likely.
+</p>
+<p>
+To switch application mode, configure it in application configuration:
+</p>
+<com:TTextHighlighter Language="xml" CssClass="source">
+<application Mode="Performance" >
+ ......
+</application >
+</com:TTextHighlighter>
+
+<h2>Reduce Page Size</h2>
+<p>
+By default, PRADO stores page state in hidden fields of the HTML output. The page state could be very large in size if complex controls, such as <tt>TDataGrid</tt>, is used. To reduce the size of the network transmitted page size, two strategies can be used.
+<p>
+First, you may disable viewstate by setting <tt>EnableViewState</tt> to false for the page or some controls on the page if they do not need user interactions. Viewstate is mainly used to keep track of page state when a user interacts with that page.
+</p>
+<p>
+Second, you may use a different page state storage. For example, page state may be stored in session, which essentially stores page state on the server side and thus saves the network transmission time. The module responsible for page state storage is <tt>System.Web.UI.TPageStatePersister</tt>, which uses hidden fields as persistent storage. To use your own storage, configure the module in application configuration as follows,
+</p>
+<com:TTextHighlighter Language="xml" CssClass="source">
+<service id="page" class="TPageService">
+ <modules>
+ <module id="state" class="MyPageStatePersister" />
+ </modules>
+</service>
+</com:TTextHighlighter>
+
+<h2>Other Techniques</h2>
+<p>
+Server caching techniques are proven to be very effective in improving the performance of PRADO applications. For example, we have observed that by using Zend Optimizer, the RPS (request per second) of a PRADO application can be increased by more than ten times. Of course, this is at the cost of stale output, while PRADO's caching techniques always ensure the correctness of the output.
+</p>
</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Themes.page b/demos/quickstart/protected/pages/Advanced/Themes.page index 40030bd5..ba5585e7 100644 --- a/demos/quickstart/protected/pages/Advanced/Themes.page +++ b/demos/quickstart/protected/pages/Advanced/Themes.page @@ -29,15 +29,29 @@ This will apply the 'Blue' skin to the button. Note, the initial property values To use the javascript files and CSS files contained in a theme, a <tt>THead</tt> control must be placed on the page template. This is because the theme will register those files with the page and <tt>THead</tt> is the right place to load those files.
</p>
+<h2>Theme Storage</h2>
+<p>
+All themes by default must be placed under the <tt>[AppEntryPath]/themes</tt> directory, where <tt>AppEntryPath</tt> refers to the directory containing the application entry script. If you want to use a different directory, configure the <tt>BasePath</tt> and <tt>BaseUrl</tt> properties of the <tt>System.Web.UI.TThemeManager</tt> module in application configuration,
+</p>
+<com:TTextHighlighter Language="xml" CssClass="source">
+<service id="page" class="TPageService">
+ <modules>
+ <module id="theme"
+ class="System.Web.UI.TThemeManager"
+ BasePath="mythemes"
+ BaseUrl="mythemes" />
+ </modules>
+</service>
+</com:TTextHighlighter>
+
<h2>Creating Themes</h2>
<p>
-Creating a theme involves creating the theme directory and writing skin files (and possibly javascript and CSS files). All themes by default must be placed under the <tt>[WebAppEntryPath]/themes</tt> directory, where <tt>WebAppEntryPath</tt> refers to the directory containing the application entry script. If you want to use a different directory, configure the <tt>BasePath</tt> and <tt>BaseUrl</tt> properties of the <tt>System.Web.UI.TThemeManager</tt> module.
-</p>
-<p>
-The format of skin files are the same as that of control template files. Since skin files do not define parent-child presentational relationship among controls, you cannot place a component tag within another. And any static texts between component tags are discarded. To define the aforementioned 'Blue' skin for <tt>TButton</tt>, write the following in a skin file,
+Creating a theme involves creating the theme directory and writing skin files (and possibly javascript and CSS files). The name of skin files must be terminated with <tt>.skin</tt>. The format of skin files are the same as that of control template files. Since skin files do not define parent-child presentational relationship among controls, you cannot place a component tag within another. And any static texts between component tags are discarded. To define the aforementioned 'Blue' skin for <tt>TButton</tt>, write the following in a skin file,
</p>
<com:TTextHighlighter Language="prado" CssClass="source">
<com:TButton SkinID="Blue" BackColor="blue" />
</com:TTextHighlighter>
-
+<p>
+As aforementioned, you can put several skins within a single skin file, or split them into several files. A commonly used strategy is that each skin file only contains skins for one type of controls. For example, <tt>Button.skin</tt> would contain skins only for the <tt>TButton</tt> control type.
+</p>
</com:TContent>
\ No newline at end of file |