summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Advanced
diff options
context:
space:
mode:
authorxue <>2006-01-27 05:28:24 +0000
committerxue <>2006-01-27 05:28:24 +0000
commitb4f691ed415c3c4157086e770e7fa36d2a414994 (patch)
tree43ff2a2475e0716100c8608c76bbf854fb293934 /demos/quickstart/protected/pages/Advanced
parent35ccbf642e8d189558e795a87005513e456d9a5d (diff)
Added Master and Content tutorial.
Diffstat (limited to 'demos/quickstart/protected/pages/Advanced')
-rw-r--r--demos/quickstart/protected/pages/Advanced/MasterContent.page37
-rw-r--r--demos/quickstart/protected/pages/Advanced/mastercontent.gifbin0 -> 10748 bytes
-rw-r--r--demos/quickstart/protected/pages/Advanced/mastercontent.vsdbin0 -> 54784 bytes
-rw-r--r--demos/quickstart/protected/pages/Advanced/pcrelation.gifbin0 -> 6600 bytes
-rw-r--r--demos/quickstart/protected/pages/Advanced/pcrelation.vsdbin0 -> 46080 bytes
5 files changed, 37 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Advanced/MasterContent.page b/demos/quickstart/protected/pages/Advanced/MasterContent.page
new file mode 100644
index 00000000..6ac1b757
--- /dev/null
+++ b/demos/quickstart/protected/pages/Advanced/MasterContent.page
@@ -0,0 +1,37 @@
+<com:TContent ID="body" >
+
+<h1>Master and Content</h1>
+<p>
+Pages in a Web application often share common portions. For example, all pages of this tutorial application share the same header and footer portions. If we repeatedly put header and footer in every page source file, it will be a maintenance headache if in future we want to something in the header or footer. To solve this problem, PRADO introduces the concept of master and content. It is essentially a decorator pattern, with content being decorated by master.
+</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>
+For example, assume a template control has the following template:
+<com:TTextHighlighter Language="prado" CssClass="source">
+&lt;%@ MasterClass="MasterControl" %&gt;
+&lt;com:TContent ID="A" &gt;
+content A
+&lt;/com:TContent &gt;
+&lt;com:TContent ID="B" &gt;
+content B
+&lt;/com:TContent &gt;
+&lt;com:TContent ID="B" &gt;
+content B
+&lt;/com:TContent &gt;
+</com:TTextHighlighter>
+which uses <tt>MasterControl</tt> as its master control. The master control has the following template,
+<com:TTextHighlighter Language="prado" CssClass="source">
+other stuff
+&lt;com:TContentPlaceHolder ID="A" /&gt;
+other stuff
+&lt;com:TContentPlaceHolder ID="B" /&gt;
+other stuff
+&lt;com:TContentPlaceHolder ID="C" /&gt;
+other stuff
+</com:TTextHighlighter>
+Then, the contents are inserted into the master control according to the following diagram, while the resulting parent-child relationship can be shown in the next diagram. Note, the template control discards everything in the template other than the contents, while the master control keeps everything and replaces the content placeholders with the contents according to ID matching.
+</p>
+<img src=<%~ mastercontent.gif %> alt="Master and Content" />
+<img src=<%~ pcrelation.gif %> alt="Parent-child relationship between master and content" />
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Advanced/mastercontent.gif b/demos/quickstart/protected/pages/Advanced/mastercontent.gif
new file mode 100644
index 00000000..9354d65c
--- /dev/null
+++ b/demos/quickstart/protected/pages/Advanced/mastercontent.gif
Binary files differ
diff --git a/demos/quickstart/protected/pages/Advanced/mastercontent.vsd b/demos/quickstart/protected/pages/Advanced/mastercontent.vsd
new file mode 100644
index 00000000..61f39b12
--- /dev/null
+++ b/demos/quickstart/protected/pages/Advanced/mastercontent.vsd
Binary files differ
diff --git a/demos/quickstart/protected/pages/Advanced/pcrelation.gif b/demos/quickstart/protected/pages/Advanced/pcrelation.gif
new file mode 100644
index 00000000..c1960d74
--- /dev/null
+++ b/demos/quickstart/protected/pages/Advanced/pcrelation.gif
Binary files differ
diff --git a/demos/quickstart/protected/pages/Advanced/pcrelation.vsd b/demos/quickstart/protected/pages/Advanced/pcrelation.vsd
new file mode 100644
index 00000000..328b0dfb
--- /dev/null
+++ b/demos/quickstart/protected/pages/Advanced/pcrelation.vsd
Binary files differ