summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorxue <>2006-01-27 17:25:06 +0000
committerxue <>2006-01-27 17:25:06 +0000
commit3064a2e196ea17b6016d80c61a6189110038a509 (patch)
treea9b70f79eaf18d16de8055b17a5ed7c291cafc22 /demos
parenta2cd529e5ff4cf1e6f49118a79fd1075ebbc1206 (diff)
Added Persistent State page to quickstart tutorial.
Diffstat (limited to 'demos')
-rw-r--r--demos/quickstart/protected/pages/Advanced/MasterContent.page1
-rw-r--r--demos/quickstart/protected/pages/Advanced/Performance.page1
-rw-r--r--demos/quickstart/protected/pages/Advanced/State.page54
3 files changed, 56 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Advanced/MasterContent.page b/demos/quickstart/protected/pages/Advanced/MasterContent.page
index 434bc413..0a68fe31 100644
--- a/demos/quickstart/protected/pages/Advanced/MasterContent.page
+++ b/demos/quickstart/protected/pages/Advanced/MasterContent.page
@@ -6,6 +6,7 @@ Pages in a Web application often share common portions. For example, all pages o
</p>
<p>
Master and content only apply to template controls (controls extending <tt>TTemplateControl</tt> or its child classes). A template control can have at most one master control and one or several contents (each represented by a <tt>TContent</tt> control). Contents will be inserted into the master control at places reserved by <tt>TContentPlaceHolder</tt> controls. And the presentation of the template control is that of the master control with <tt>TContentPlaceHolder</tt> replaced by <tt>TContent</tt>.
+</p>
<p>
For example, assume a template control has the following template:
</p>
diff --git a/demos/quickstart/protected/pages/Advanced/Performance.page b/demos/quickstart/protected/pages/Advanced/Performance.page
index 5aee4a9b..8b10da56 100644
--- a/demos/quickstart/protected/pages/Advanced/Performance.page
+++ b/demos/quickstart/protected/pages/Advanced/Performance.page
@@ -60,6 +60,7 @@ To switch application mode, configure it in application configuration:
<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>
<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>
diff --git a/demos/quickstart/protected/pages/Advanced/State.page b/demos/quickstart/protected/pages/Advanced/State.page
new file mode 100644
index 00000000..30d5b2fc
--- /dev/null
+++ b/demos/quickstart/protected/pages/Advanced/State.page
@@ -0,0 +1,54 @@
+<com:TContent ID="body" >
+
+<h1>Persistent State</h1>
+<p>
+Web applications often need to remember what an end user has done in previous page requests so that the new page request can be served accordingly. State persistence is to address this problem. Traditionally, if a page needs to keep track of user interactions, it will resort to session, cookie, or hidden fields. PRADO provides a new line of state persistence schemes, including view state, control state, and application state.
+</p>
+
+<h2>View State</h2>
+<p>
+View state lies at the heart of PRADO. With view state, Web pages become stateful and are capable of restoring pages to the state that end users interacted with before the current page request. Web programming thus resembles to Windows GUI programming, and developers can think continuously without worrying about the roundtrips between end users and the Web server. For example, with view state, a textbox control is able to detect if the user input changes the content in the textbox.
+</p>
+<p>
+View state is only available to controls. View state of a control can be disabled by setting its <tt>EnableViewState</tt> property to false. To store a variable in view state, call the following,
+</p>
+<com:TTextHighlighter CssClass="source">
+$this->setViewState('Caption',$caption);
+</com:TTextHighlighter>
+<p>
+where <tt>$this</tt> refers to the control object, <tt>Caption</tt> is a unique key identifying the <tt>$caption</tt> variable stored in viewstate. To retrieve the variable back from view state, call the following,
+</p>
+<com:TTextHighlighter CssClass="source">
+$caption = $this->getViewState('Caption');
+</com:TTextHighlighter>
+
+<h2>Control State</h2>
+<p>
+Control state is like view state in every aspect except that control state cannot be disabled. Control state is intended to be used for storing crucial state information without which a page or control may not work properly.
+</p>
+<p>
+To store and retrieve a variable in control state, use the followign commands,
+</p>
+<com:TTextHighlighter CssClass="source">
+$this->setControlState('Caption',$caption);
+$caption = $this->getControlState('Caption');
+</com:TTextHighlighter>
+
+<h2>Application State</h2>
+<p>
+Application state refers to data that is persistent across user sessions and page requests. A typical example of application state is the user visit counter. The counter value is persistent even if the current user session terminates. Note, view state and control state are lost if the user requests for a different page, while session state is lost if the user session terminates.
+</p>
+<p>
+To store and retrieve a variable in application state, use the followign commands,
+</p>
+<com:TTextHighlighter CssClass="source">
+$application->setGlobalState('Caption',$caption);
+$caption = $application->getGlobalState('Caption');
+</com:TTextHighlighter>
+
+<h2>Session State</h2>
+<p>
+PRADO encapsulates the traditional session management in <tt>THttpSession</tt> module. The module can be accessed from within any component by using <tt>$this->Session</tt>, where <tt>$this</tt> refers to the component object.
+</p>
+
+</com:TContent> \ No newline at end of file