diff options
author | xue <> | 2006-04-16 03:43:55 +0000 |
---|---|---|
committer | xue <> | 2006-04-16 03:43:55 +0000 |
commit | 82c4e88a3961e281073b3818fe015a4d62d1592e (patch) | |
tree | 379a4f4063b71dab2011424891363d8202c1a6a2 /demos/quickstart | |
parent | 4f15d896ab3af600d28a6e75b0240d49d8e023f1 (diff) |
Added files for Hello World.
Diffstat (limited to 'demos/quickstart')
-rw-r--r-- | demos/quickstart/protected/pages/GettingStarted/HelloWorld.page | 72 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/GettingStarted/directory.gif | bin | 0 -> 2685 bytes | |||
-rw-r--r-- | demos/quickstart/protected/pages/GettingStarted/sequence.gif | bin | 0 -> 5793 bytes | |||
-rw-r--r-- | demos/quickstart/protected/pages/GettingStarted/sequence.vsd | bin | 0 -> 143872 bytes |
4 files changed, 72 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/GettingStarted/HelloWorld.page b/demos/quickstart/protected/pages/GettingStarted/HelloWorld.page new file mode 100644 index 00000000..b5016f4e --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/HelloWorld.page @@ -0,0 +1,72 @@ +<com:TContent ID="body" >
+<h1>My First PRADO Application</h1>
+<p>
+In this section, we guide you through creating your first PRADO application, the famous "Hello World" application.
+</p>
+<p>
+"Hello World" perhaps is the simplest <i>interactive</i> PRADO application that you can create. It displays to end-users a page with a submit button whose caption is <tt>Click Me</tt>. After the user clicks on the button, its caption is changed to <tt>Hello World</tt>.
+</p>
+<p>
+There are many approaches that can achieve the above goal. One can submit the page to the server, examine the POST variable, and generate a new page with the button caption updated. Or one can simply use JavaScript to update the button caption upon its <tt>onclick</tt> client event.
+</p>
+<p>
+PRADO promotes component-based and event-driven Web programming. The button is represented by a <tt>TButton</tt> object. It encapsulates the button caption as the <tt>Text</tt> property and associates the user button click action with a server-side <tt>OnClick</tt> event. To respond to the user clicking on the button, one simply needs to attach a function to the button's <tt>OnClick</tt> event. Within the function, the button's <tt>Text</tt> property is modified as "Hello World". The following diagram shows the above sequence,
+</p>
+<img src="<%~sequence.gif%>" />
+<p>
+Our PRADO application consists of three files, <tt>index.php</tt>, <tt>Home.page</tt> and <tt>Home.php</tt>, which are organized as follows,
+</p>
+<img src="<%~directory.gif%>" />
+<p>
+where each directory is explained as follows. Note, the above directory structure can be customized. For example, one can move the <tt>protected</tt> directory out of Web directories. You will know how to do this after you go through this tutorial.
+</p>
+<ul>
+<li><tt>assets</tt> - directory storing published private files. See <a href="?page=Advanced.Assets">assets</a> section for more details. This directory must be writable by the Web server process.</li>
+<li><tt>protected</tt> - application base path storing application data and private script files. This directory should be configured as inaccessible to end-users.</li>
+<li><tt>runtime</tt> - application runtime storage path storing application runtime information, such as application state, cached data, etc. This directory must be writable by the Web server process.</li>
+<li><tt>pages</tt> - base path storing all PRADO pages.</li>
+</ul>
+
+<p>
+The three files that we need are explained as follows.
+</p>
+<ul>
+<li><tt>index.php</tt> - entry script of the PRADO application. This file is required by all PRADO applications and is the only script file that is directly accessible by end-users. Content in <tt>index.php</tt> mainly consists of the following three lines,
+<com:TTextHighlighter CssClass="source">
+require_once('path/to/prado.php'); // include the prado script
+$application=new TApplication; // create a PRADO application instance
+$application->run(); // run the application
+</com:TTextHighlighter>
+</li>
+<li><tt>Home.page</tt> - template for the default page returned when users do not explicitly specify the page requested. A template specifies the presentational layout of components. In this example, we use two components, <tt>TForm</tt> and <tt>TButton</tt>, which correspond to the <form> and <input> HTML tags, respectively. The template contains the following content,
+<com:TTextHighlighter Language="prado" CssClass="source">
+<html>
+ <body>
+ <com:TForm>
+ <com:TButton Text="Click me" OnClick="buttonClicked" />
+ </com:TForm>
+ </body>
+</html>
+</com:TTextHighlighter>
+</li>
+<li><tt>Home.php</tt> - page class for the <tt>Home</tt> page. It mainly contains the method responding to the <tt>OnClick</tt> event of the button.
+<com:TTextHighlighter CssClass="source">
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ // $sender refers to the button component
+ $sender->Text="Hello World!";
+ }
+}
+</com:TTextHighlighter>
+</li>
+</ul>
+<p>
+The application is now ready and can be accessed via: <tt>http://Web-server-address/helloworld/index.php</tt>, assuming <tt>helloworld</tt> is directly under the Web <tt>DocumentRoot</tt>. Try to change <tt>TButton</tt> in <tt>Home.page</tt> to <tt>TLinkButton</tt> and see what happens.
+</p>
+<p>
+Complete source code of this demo can be found in the PRADO release. You can also try the <a href="http://www.pradosoft.com/demos/helloworld/">online demo</a>.
+</p>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/GettingStarted/directory.gif b/demos/quickstart/protected/pages/GettingStarted/directory.gif Binary files differnew file mode 100644 index 00000000..e6c4f724 --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/directory.gif diff --git a/demos/quickstart/protected/pages/GettingStarted/sequence.gif b/demos/quickstart/protected/pages/GettingStarted/sequence.gif Binary files differnew file mode 100644 index 00000000..4207a9bb --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/sequence.gif diff --git a/demos/quickstart/protected/pages/GettingStarted/sequence.vsd b/demos/quickstart/protected/pages/GettingStarted/sequence.vsd Binary files differnew file mode 100644 index 00000000..840dc26f --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/sequence.vsd |