From 9be8859d92e4bbec2462e82457d014f0a0d720db Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 26 Dec 2005 15:54:54 +0000 Subject: --- .gitattributes | 16 +++++ .../protected/pages/Configurations/AppConfig.page | 40 +++++++++++ .../protected/pages/Configurations/Overview.page | 10 +++ .../protected/pages/Configurations/PageConfig.page | 36 ++++++++++ .../protected/pages/Configurations/Templates1.page | 69 +++++++++++++++++++ .../protected/pages/Configurations/Templates2.page | 78 ++++++++++++++++++++++ .../protected/pages/Configurations/Templates3.page | 73 ++++++++++++++++++++ .../protected/pages/Controls/Overview.page | 15 +++++ .../protected/pages/Controls/Simple1.page | 2 + .../protected/pages/Fundamentals/Components.page | 49 ++++++++++++++ .../protected/pages/Fundamentals/Controls.page | 19 ++++++ .../protected/pages/Fundamentals/Pages.page | 8 +++ .../protected/pages/GettingStarted/AboutPrado.page | 19 ++++++ .../pages/GettingStarted/Installation.page | 21 ++++++ .../pages/GettingStarted/Introduction.page | 6 ++ .../protected/pages/Samples/Hangman.page | 16 +++++ .../protected/pages/Samples/HelloWorld.page | 26 ++++++++ demos/quickstart/protected/pages/TopicList.tpl | 44 +++++++----- .../protected/pages/chap2/KeyConcepts.page | 40 ++++++++++- 19 files changed, 568 insertions(+), 19 deletions(-) create mode 100644 demos/quickstart/protected/pages/Configurations/AppConfig.page create mode 100644 demos/quickstart/protected/pages/Configurations/Overview.page create mode 100644 demos/quickstart/protected/pages/Configurations/PageConfig.page create mode 100644 demos/quickstart/protected/pages/Configurations/Templates1.page create mode 100644 demos/quickstart/protected/pages/Configurations/Templates2.page create mode 100644 demos/quickstart/protected/pages/Configurations/Templates3.page create mode 100644 demos/quickstart/protected/pages/Controls/Overview.page create mode 100644 demos/quickstart/protected/pages/Controls/Simple1.page create mode 100644 demos/quickstart/protected/pages/Fundamentals/Components.page create mode 100644 demos/quickstart/protected/pages/Fundamentals/Controls.page create mode 100644 demos/quickstart/protected/pages/Fundamentals/Pages.page create mode 100644 demos/quickstart/protected/pages/GettingStarted/AboutPrado.page create mode 100644 demos/quickstart/protected/pages/GettingStarted/Installation.page create mode 100644 demos/quickstart/protected/pages/GettingStarted/Introduction.page create mode 100644 demos/quickstart/protected/pages/Samples/Hangman.page create mode 100644 demos/quickstart/protected/pages/Samples/HelloWorld.page diff --git a/.gitattributes b/.gitattributes index ce2efce3..79c531f6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,9 +14,25 @@ demos/personal/themes/BlueTheme/labels.skin -text demos/quickstart/index.php -text demos/quickstart/protected/.htaccess -text demos/quickstart/protected/application.xml -text +demos/quickstart/protected/pages/Configurations/AppConfig.page -text +demos/quickstart/protected/pages/Configurations/Overview.page -text +demos/quickstart/protected/pages/Configurations/PageConfig.page -text +demos/quickstart/protected/pages/Configurations/Templates1.page -text +demos/quickstart/protected/pages/Configurations/Templates2.page -text +demos/quickstart/protected/pages/Configurations/Templates3.page -text demos/quickstart/protected/pages/Construction.page -text +demos/quickstart/protected/pages/Controls/Overview.page -text +demos/quickstart/protected/pages/Controls/Simple1.page -text +demos/quickstart/protected/pages/Fundamentals/Components.page -text +demos/quickstart/protected/pages/Fundamentals/Controls.page -text +demos/quickstart/protected/pages/Fundamentals/Pages.page -text +demos/quickstart/protected/pages/GettingStarted/AboutPrado.page -text +demos/quickstart/protected/pages/GettingStarted/Installation.page -text +demos/quickstart/protected/pages/GettingStarted/Introduction.page -text demos/quickstart/protected/pages/Layout.php -text demos/quickstart/protected/pages/Layout.tpl -text +demos/quickstart/protected/pages/Samples/Hangman.page -text +demos/quickstart/protected/pages/Samples/HelloWorld.page -text demos/quickstart/protected/pages/TopicList.php -text demos/quickstart/protected/pages/TopicList.tpl -text demos/quickstart/protected/pages/ViewSource.page -text diff --git a/demos/quickstart/protected/pages/Configurations/AppConfig.page b/demos/quickstart/protected/pages/Configurations/AppConfig.page new file mode 100644 index 00000000..b6bf89f5 --- /dev/null +++ b/demos/quickstart/protected/pages/Configurations/AppConfig.page @@ -0,0 +1,40 @@ + + +

Application Configurations

+

+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 stored in an XML file which is passed as a parameter to the TApplication instance. The format of application configurations is shown in the following, +

+<application PropertyName="PropertyValue" ...>
+  <paths>
+    <alias id="AliasID" path="AliasPath" />
+    <using namespace="Namespace" />
+  </paths>
+  <modules>
+    <module id="ModuleID" class="ModuleClass"  PropertyName="PropertyValue" ... />
+  </modules>
+  <services>
+    <service id="ServiceID" class="ServiceClass" PropertyName="PropertyValue" ... />
+  </services>
+  <parameters>
+    <parameter id="ParameterID" class="ParameterClass" PropertyName="PropertyValue" ... />
+  </parameters>
+</application>
+
+ +By default without explicit configuration, a PRADO application when running will load a few core modules, such as THttpRequest, THttpResponse, etc. It will also provide the TPageService as a default service. Configuration and usage of these modules and services are covered in individual sections of this tutorial. Note, if your application takes default settings for these modules and service, you do not need to provide an application configuration. However, if these modules or services are not sufficient, or you want to change their behavior by configuring their property values, you will need an application configuration. +

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Configurations/Overview.page b/demos/quickstart/protected/pages/Configurations/Overview.page new file mode 100644 index 00000000..4a23f306 --- /dev/null +++ b/demos/quickstart/protected/pages/Configurations/Overview.page @@ -0,0 +1,10 @@ + +

Configuration Overview

+

+PRADO uses configurations to glue together components into pages and applications. There are application configurations, page configurations, and templates. +

+

+Application and page configurations are optional if default values are used. Templates are mainly used by pages and template controls. They are optional, too. +

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Configurations/PageConfig.page b/demos/quickstart/protected/pages/Configurations/PageConfig.page new file mode 100644 index 00000000..7842e4f3 --- /dev/null +++ b/demos/quickstart/protected/pages/Configurations/PageConfig.page @@ -0,0 +1,36 @@ + + +

Page Configurations

+

+Page configurations are mainly used by TPageService to modify or append the application configuration. As the name indicates, a page configuration is associated with a directory storing some page files. It is stored as an XML file named config.xml. +

+

+When a user requests a page stored under <BasePath>/dir1/dir2, the TPageService will try to parse and load config.xml files under <BasePath>/dir1 and <BasePath>/dir1/dir2. Paths, modules, and parameters specified in these configuration files will be appended or merged into the existing application configuration. +

+

+The format of a page configuration file is as follows, +

+<configuration>
+  <paths>
+    <alias id="AliasID" path="AliasPath" />
+    <using namespace="Namespace" />
+  </paths>
+  <modules>
+    <module id="ModuleID" class="ModuleClass"  PropertyName="PropertyValue" ... />
+  </modules>
+  <authorization>
+    <allow pages="PageID1,PageID2" users="User1,User2" roles="Role1,Role2" verb="post" />
+    <deny pages="PageID1,PageID2" users="User1,User2" roles="Role1,Role2" verb="post" />
+  </authorization>
+  <pages PropertyName="PropertyValue" ...>
+    <page id="PageID" PropertyName="PropertyValue" ... />
+  </pages>
+  <parameters>
+    <parameter id="ParameterID" class="ParameterClass" PropertyName="PropertyValue" ... />
+  </parameters>
+</configuration>
+
+The <paths>, <modules> and <parameters> are similar to those in an application configuration. The <authorization> specifies the authorization rules that apply to the current page directory and all its subdirectories. It will be explained in more detail in future sections. The <pages> element specifies the initial values for the properties of pages. Each <page> element specifies the initial property values for a particular page identified by the id<pages> element apply to all pages in the current directory and all its subdirectories. +

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Configurations/Templates1.page b/demos/quickstart/protected/pages/Configurations/Templates1.page new file mode 100644 index 00000000..c406cfad --- /dev/null +++ b/demos/quickstart/protected/pages/Configurations/Templates1.page @@ -0,0 +1,69 @@ + +

Templates: Part I

+

+Templates are used to specify the presentational layout of controls. A template can contain static text, components, or controls that contribute to the ultimate presentation of the associated control. By default, an instance of TTemplateControl or its subclass may automatically load a template from a file whose name is the same as the control class name. For page templates, the file name suffix must be .page; for other regular template controls, the suffix is .tpl. +

+

The template format is like HTML, with a few PRADO-specifc tags, including component tags, template control tags, comment tags, dynamic content tags, and dynamic property tags. . +

+ + +

Component Tags

+

+A component tag specifies a component as part of the body content of the template control. If the component is a control, it usually will become a child or grand child of the template control, and its rendering result will be inserted at the place where it is appearing in the template. +

+

+The format of a component tag is as follows, +

+<com:ComponentType PropertyName="PropertyValue" ... EventName="EventHandler" ...>
+body content
+</com:ComponentType>
+
+ComponentType can be either the class name or the dotted type name (e.g. System.Web.UI.TControl) of the component. PropertyName and EventName are both case-insensitive. PropertyName can be a property or subproperty name (e.g. Font.Name). Note, PropertyValue will be HTML-decoded when assigned to the corresponding property. Content enclosed between the opening and closing component tag are normally treated the body of the component. +

+

+It is required that component tags nest properly with each other and an opening component tag be paired with a closing tag, similar to that in XML. The following shows a component tag specifying the Text property and Click event of a button control, +

+<com:TButton Text="Register" Click="registerUser" />
+
+

+

+To deal conveniently with properties taking take big trunk of initial data, the following property initialization tag is introduced, +

+<prop:PropertyName>
+PropertyValue
+</prop:PropertyName>
+
+It is equivalent to ...PropertyName="PropertyValue"... in a component tag. Property initialization tags must be directly enclosed between the corresponding opening and closing component tag. +

+ +
+

Template Control Tags

+A template control tag is used to configure the initial property values of the control owning the template. Its format is as follows, +
+<%@ PropertyName="PropertyValue" ... %>
+
+Like in component tags, PropertyName is case-insensitive and can be a property or subproperty name. +

+

+Initial values specified via the template control tag are assigned to the corresponding properties when the template control is being constructed. Therefore, you may override these property values in a later stage, such as the Init stage of the control. +

+

+Template control tag is optional in a template. Each template can contain at most one template control tag. You can place the template control tag anywhere in the template. It is recommended that you place it at the beginning of the template for better visibility. +

+ +
+

Comment Tags

+

+Comment tags are used to put comments in the template or the ultimate rendering result. There are two types of comment tags. One is like that in HTML and will be displayed to the end-users. The other only appear in a template and will be stripped out when the template is instantiated and displayed to the end-users. The format of these two comment tags is as follows, +

+<!--
+Comments VISIBLE to end-users
+-->
+
+<!
+Comments INVISIBLE to end-users
+!>
+
+

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Configurations/Templates2.page b/demos/quickstart/protected/pages/Configurations/Templates2.page new file mode 100644 index 00000000..b7eaaf7a --- /dev/null +++ b/demos/quickstart/protected/pages/Configurations/Templates2.page @@ -0,0 +1,78 @@ + +

Templates: Part II

+ +
+

Dynamic Content Tags

+

+Dynamic content tags are introduced as shortcuts to some commonly used component tags. These tags are mainly used to render contents resulted from evaluating some PHP expressions or statements. They include expression tags, statement tags, databind tags, parameter tags and asset tags. +

+ + +

Expression Tags

+

+An expression tag represents a PHP expression that is evaluated when the template control is being rendered. The expression evaluation result is inserted at the place where the tag resides in the template. Its format is as follows, +

+<%= PhpExpression %>
+
+Inernally, an expression tag is represented by a TExpression control. Therefore, in the expression $this refers to the TExpression control. For example, the following expression tag will display the current page title at the place, +
+<%= $this->Page->Title %>
+
+

+ +
+

Statement Tags

+

+Statement tags are similar to expression tags, except that statement tags contain PHP statements rather than expressions. The output of the PHP statements (using for example echo or print in PHP) are displayed at the place where the statement tag resides in the template. Inernally, a statement tag is represented by a TStatements control. Therefore, in the statements $this refers to the TStatements control. The format of statement tags is as follows, +

+<%%
+PHP Statements
+%>
+
+

+

+The following example displays the current time in Dutch at the place, +

+<%%
+setlocale(LC_ALL, 'nl_NL');
+echo strftime("%A %e %B %Y",time());
+%>
+
+

+ +
+

Databind Tags

+

+Databind tags are similar to expression tags, except that the expressions are evaluated only when a dataBind() call is invoked on the controls representing the databind tags. Internally, a TLiteral control is used to represent a databind tag and $this in the expression would refer to the control. The format of databind tags is as follows, +

+<%# PhpExpression %>
+
+

+ +
+

Parameter Tags

+

+Parameter tags are used to insert application parameters at the place where they appear in the template. The format of parameter tags is as follows, +

+<%$ ParameterName %>
+
+Note, application parameters are usually defined in application configurations or page directory configurations. The parameters are evaluated when the template is instantiated. +

+ +
+

Asset Tags

+

+Asset tags are used to publish private files and display the corresponding the URLs. For example, if you have an image file that is not Web-accessible and you want to make it visible to end-users, you can use asset tags to publish this file and show the URL to end-users so that they can fetch the published image. +

+

+The format of asset tags is as follows, +

+<%~ LocalFileName %>
+
+where LocalFileName refers to a file path that is relative to the directory containing the current template file. The file path can be a single file or a directory. If the latter, the content in the whole directory will be made accessible by end-users. +

+

+BE VERY CAUTIOUS when you are using asset tags as it may expose to end-users files that you probably do not want them to see. +

+ + \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Configurations/Templates3.page b/demos/quickstart/protected/pages/Configurations/Templates3.page new file mode 100644 index 00000000..328687fb --- /dev/null +++ b/demos/quickstart/protected/pages/Configurations/Templates3.page @@ -0,0 +1,73 @@ + +

Templates: Part III

+ +
+

Dynamic Property Tags

+

+Dynamic property tags are very similar to dynamic content tags, except that they are applied to component properties. The purpose of dynamic property tags is to allow more versatile component property configuration. Note, you are not required to use dynamic property tags because what can be done using dynamic property tags can also be done in PHP code. However, using dynamic property tags bring you much more convenience at accomplishing the same tasks. The basic usage of dynamic property tags is as follows, +

+<com:ComponentType PropertyName=DynamicPropertyTag ...>
+body content
+</com:ComponentType>
+
+where you may enclose DynamicPropertyTag within single or double quotes for better readability. +

+

+We now introduce the available types of dynamic property tags that may be used in the above. Like dynamic content tags, we have expression tags, databind tags, parameter tags and asset tags. (Note, there is no statement tag here.) +

+ + +

Expression Tags

+

+An expression tag represents a PHP expression that is evaluated when the template is being instantiated. The expression evaluation result is assigned to the corresponding component property. The format of expression tags is as follows, +

+<%= PhpExpression %>
+
+In the expression, $this refers to the component specified by the component tag. The following example specifies a TLabel control whose Text property is initialized as the current page title when the TLabel control is being constructed, +
+<com:TLabel Text=<%= $this->Page->Title %> />
+
+

+

+Note, unlike dynamic content tags, the expressions tags for component properties are evaluated when the components are being constructed, while for the dynamic content tags, the expressions are evaluated when the controls are being rendered. +

+ +
+

Databind Tags

+

+Databind tags are similar to expression tags, except that the expressions are evaluated only when a dataBind() call is invoked on the controls represented by the component tags. In the expression, $this refers to the control itself. Databind tags do not apply to all components. They can only be used for controls. +

+

+The format of databind tags is as follows, +

+<%# PhpExpression %>
+
+

+ +
+

Parameter Tags

+

+Parameter tags are used to assign application parameter values to the corresponding component properties. The format of parameter tags is as follows, +

+<%$ ParameterName %>
+
+Note, application parameters are usually defined in application configurations or page directory configurations. The parameters are evaluated when the template is instantiated. +

+ +
+

Asset Tags

+

+Asset tags are used to publish private files and assign the corresponding the URLs to the component properties. For example, if you have an image file that is not Web-accessible and you want to make it visible to end-users, you can use asset tags to publish this file and show the URL to end-users so that they can fetch the published image. +

+

+The format of asset tags is as follows, +

+<%~ LocalFileName %>
+
+where LocalFileName refers to a file path that is relative to the directory containing the current template file. The file path can be a single file or a directory. If the latter, the content in the whole directory will be made accessible by end-users. +

+

+BE VERY CAUTIOUS when you are using asset tags as it may expose to end-users files that you probably do not want them to see. +

+ + \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Overview.page b/demos/quickstart/protected/pages/Controls/Overview.page new file mode 100644 index 00000000..7c3fbea6 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Overview.page @@ -0,0 +1,15 @@ + +

Controls Overview

+

+A control is an instance of class TControl or its subclass. A control is a component defined in addition with user interface. The base class TControl defines the parent-child relationship among controls which reflects the containment relationship among user interface elements. +

+

+Control classes constitute one of the major part of PRADO framework. Nearly every generic HTML element can find its representation in terms of a PRADO control. Mastering these controls becomes extremely important to effectively and efficiently compose applications using PRADO. +

+

+In this section, we will first introduce the ...., then.... +

+

+To be continued... +

+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Simple1.page b/demos/quickstart/protected/pages/Controls/Simple1.page new file mode 100644 index 00000000..a608c8d2 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Simple1.page @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Components.page b/demos/quickstart/protected/pages/Fundamentals/Components.page new file mode 100644 index 00000000..ec6dbd48 --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Components.page @@ -0,0 +1,49 @@ + +

Components

+

+A component is an instance of TComponent or its child class. The base class TComponent implements the mechanism of component properties and events. +

+ +

Component Properties

+

+A component property can be viewed as a public variable describing a specific aspect of the component, such as the background color, the font size, etc. A property is defined by the existence of a getter and/or a setter method in the component class. For example, in TControl, we have +

+class TControl extends TComponent {
+    public function getID() {
+        ...
+    }
+    public function setID($value) {
+        ...
+    }
+}
+
+This defines a property named ID. Reading the property (e.g. echo $component->ID;) is equivalent to invoking the getter method (e.g. echo $component->getID();); and writing the property (e.g. $component->ID='Button';) is equivalent to invoking the setter method (e.g. $component->setID('Button');). +

+

+A property is read-only if it has a getter method but no setter method. Since PHP method names are case-insensitive, property names are also case-insensitive. A component class inherits all its ancestor classes' properties. +

+ +

Component Events

+

+Component events are special properties that take method names as their values. Attaching (setting) a method to an event will hook up the method to the places at which the event is raised. Therefore, the behavior of a component can be modified in a way that may not be foreseen during the development of the component. +

+

+A component event is defined by the existence of an on-method. For example, in TButton, we have +

+class TButton extends TWebControl {
+    public function onClick($param) {
+        ...
+    }
+}
+
+This defines an event named Click, and a handler can be attached to the event using one of the following ways, +
+$button->Click=$callback;
+$button->Click->add($callback);
+$button->Click[]=$callback;
+$button->attachEventHandler('Click',$callback);
+
+where $callback refers to a valid PHP callback (e.g. a function name, a class method array($object,'method'), etc.) +

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Controls.page b/demos/quickstart/protected/pages/Fundamentals/Controls.page new file mode 100644 index 00000000..7703003d --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Controls.page @@ -0,0 +1,19 @@ + +

Controls

+

+A control is an instance of class TControl or its subclass. A control is a component defined in addition with user interface. The base class TControl defines the parent-child relationship among controls which reflects the containment relationship among user interface elements. +

+ +

Parent-Child Relationship

+

+A parent control is in charge of the state transition of its child controls. The rendering result of the child controls are usually used to compose the parent control's presentation. +

+

+The parent-child relationship is usually established by the framework via templates. In code, you may explicitly specify a control as a child of another using the following method, +

+$parent->Controls->add($child);
+
+where the property Controls refers to the child control collection of the parent. +

+ + \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Pages.page b/demos/quickstart/protected/pages/Fundamentals/Pages.page new file mode 100644 index 00000000..71434ae1 --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Pages.page @@ -0,0 +1,8 @@ + + +

Pages

+

+Pages are top-most controls that have no parent (you may consider application as their container though). The presentation of pages are directly displayed to end-users. +

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page b/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page new file mode 100644 index 00000000..03d9afe8 --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page @@ -0,0 +1,19 @@ + +

What is PRADO?

+

+PRADO stands for PHP Rapid Application Development +Object-oriented. +

+

+PRADO is a component-based and event-driven programming framework for developing Web applications in PHP 5. +

+

+PRADO stipulates a protocol of writing and using components to construct Web applications. A component is a software unit that is self-contained and can be reused with trivial customization. New components can be developed by either inheriting or composing from existing ones. Component-based programming brings great freedom in teamwork anf offers the ultimate extensibility and maintenability to the code. PRADO implements a set of elementary components that represent commonly used Web elements, such as input field, checkbox, dropdown list, etc. +

+

+PRADO implements an event-driven programming scheme that allows delegation of extensible behavior to components. End-user activities, such as clicking on a submit button, changing the content in an input field, are captured as server events. Methods or functions may be attached to these events so that when the events happen, they are invoked automatically to respond to the events. Compared with the traditional Web programming in which developers have to deal with the raw POST or GET variables, event-driven programming helps developers better focus on the necessary logic and reduces significantly the low-level repetitive coding. +

+

+Developing a PRADO Web application mainly involves instantiating prebuilt component types, configuring them by setting their properties, responding to their events by writing handler functions, and composing them into pages for the application. It is very similar to RAD toolkits, such as Borland Delphi and Microsoft Visual Basic, that are used to develop desktop GUI applications. +

+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/GettingStarted/Installation.page b/demos/quickstart/protected/pages/GettingStarted/Installation.page new file mode 100644 index 00000000..619d613f --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/Installation.page @@ -0,0 +1,21 @@ + +

Installing PRADO

+

+If you are viewing this page from your own Web server, you are already done with the installation. The instructions at the end of this page, however, may still be useful for you to troubleshoot issues happened during your development based on PRADO. +

+

+Installation of PRADO is very easy. Follow the following steps, +

    +
  1. Go to pradosoft.com to grab a latest version of PRADO.
  2. +
  3. Unpack the PRADO release file using unzip on Linux or winzip on Windows. A directory named prado will be created under the working directory.
  4. +
  5. Copy or upload everything under the prado directory to the DocumentRoot directory (or a subdirectory) of the Web server.
  6. +
  7. Your installation of PRADO is done and you can start to play with the demo applications included in the PRADO release via URL http://web-server-address/demos/. This QuickStart Tutorial is one of such applications.
  8. +
+

+

+If you encounter any problems with the demo applications, please use the PRADO requirement checker script to check if your server configuration fullfils the conditions required by PRADO. +

+

+The minimum requirement by PRADO is that the Web server support PHP 5. PRADO has been tested with Apache Web server on Windows and Linux. Highly possibly it may also run on other platforms with other Web servers, as long as PHP 5 is supported. +

+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/GettingStarted/Introduction.page b/demos/quickstart/protected/pages/GettingStarted/Introduction.page new file mode 100644 index 00000000..dc7a0497 --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/Introduction.page @@ -0,0 +1,6 @@ + +

Welcome to the PRADO QuickStart Tutorial

+

+This QuickStart tutorial is meant to get you quickly started to build your own Web applications based on PRADO. +

+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Samples/Hangman.page b/demos/quickstart/protected/pages/Samples/Hangman.page new file mode 100644 index 00000000..4541c8f9 --- /dev/null +++ b/demos/quickstart/protected/pages/Samples/Hangman.page @@ -0,0 +1,16 @@ + +

Sample: Hangman Game

+

+Having seen the simple "Hello World" application, we now build a more complex application called "Hangman Game". In this game, the player is asked to guess a word, a letter at a time. If he guesses a letter right, the letter will be shown in the word. The player can continue to guess as long as the number of his misses is within a prespecified bound. The player wins the game if he finds out the word within the miss bound, or he loses. +

+

+To facilitate the building of this game, we show the state transition diagram of the gaming process in the following, +

+

+To be continued... +

+
+Run Sample +View Source +
+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Samples/HelloWorld.page b/demos/quickstart/protected/pages/Samples/HelloWorld.page new file mode 100644 index 00000000..98d29265 --- /dev/null +++ b/demos/quickstart/protected/pages/Samples/HelloWorld.page @@ -0,0 +1,26 @@ + +

Sample: Hello World

+

+"Hello World" is the simplest interactive PRADO application that you can build. It displays to end-users a page with a submit button whose caption is Click Me. When the user clicks on the button, the button changes the caption to Hello World. +

+

+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 onclick event. +

+

+PRADO promotes component-based and event-driven Web programming. The button is represented by a TButton object. It encapsulates the button caption as the Text property and associates the user button click action with a server-side Click event. Therefore, the "Hello World" task can be handled intuitively and easily. One simply needs to attach a function to the button's Click event. Within the function, the button's Text property is modified as "Hello World". The following diagram shows the above sequence, +

+ +

+The code that a developer needs to write is merely the following event handler function, where $sender refers to the button object. +

+
+public function buttonClicked($sender,$param)
+{
+	$sender->Text="Hello World";
+}
+
+
+Run Sample +View Source +
+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/TopicList.tpl b/demos/quickstart/protected/pages/TopicList.tpl index 0cfcb827..ac34b034 100644 --- a/demos/quickstart/protected/pages/TopicList.tpl +++ b/demos/quickstart/protected/pages/TopicList.tpl @@ -2,33 +2,43 @@
Getting Started
-Introduction
-What is PRADO?
-Installation
+Introduction
+What is PRADO?
+Installation
Fundamentals
-Architecture
-Key Concepts
-Application Structure
-Configurations
-Templates: Part I
-Templates: Part II
-Templates: Part III
+Architecture
+Components
+Controls
+Pages
+Modules
+Services
+Applications
+
+ +
+Configurations
+Overview
+Templates: Part I
+Templates: Part II
+Templates: Part III
+Application Configurations
+Page Configurations
Samples
-Hello World
-Hangman Game
+Hello World
+Hangman Game
Controls
-Overview
-Simple Controls: Part I
-Simple Controls: Part II
+Overview
+Simple Controls: Part I
+Simple Controls: Part II
Validation Controls
List Controls
TRepeater
@@ -48,8 +58,8 @@
Avanced Features
Overview
-Theme and Skin
-Asset
+Themes and Skins
+Assets
Internationalization
diff --git a/demos/quickstart/protected/pages/chap2/KeyConcepts.page b/demos/quickstart/protected/pages/chap2/KeyConcepts.page index 5352d1ff..701633c4 100644 --- a/demos/quickstart/protected/pages/chap2/KeyConcepts.page +++ b/demos/quickstart/protected/pages/chap2/KeyConcepts.page @@ -8,7 +8,7 @@ A component is an instance of TComponent or its child class. The ba

Component Properties

-A property can be viewed as a public variable describing a specific aspect of the component, such as the background color, the font size, etc. A property is defined by the existence of a getter and/or a setter method of a component class. For example, in TControl, we have +A component property can be viewed as a public variable describing a specific aspect of the component, such as the background color, the font size, etc. A property is defined by the existence of a getter and/or a setter method in the component class. For example, in TControl, we have

 class TControl extends TComponent {
     public function getID() {
@@ -22,16 +22,52 @@ class TControl extends TComponent {
 This defines a property named ID. Reading the property (e.g. echo $component->ID;) is equivalent to invoking the getter method (e.g. echo $component->getID();); and writing the property (e.g. $component->ID='Button';) is equivalent to invoking the setter method (e.g. $component->setID('Button');).
 

-A property is read-only if it only has a getter method and no setter method. Since PHP method names are case-insensitive, property names are also case-insensitive. +A property is read-only if it has a getter method but no setter method. Since PHP method names are case-insensitive, property names are also case-insensitive. A component class inherits all its ancestor classes' properties.

Component Events

+

+Component events are special properties that take method names as their values. Attaching (setting) a method to an event will hook up the method to the places at which the event is raised. Therefore, the behavior of a component can be modified in a way that may not be foreseen during the development of the component. +

+

+A component event is defined by the existence of an on-method. For example, in TButton, we have +

+class TButton extends TWebControl {
+    public function onClick($param) {
+        ...
+    }
+}
+
+This defines an event named Click, and a handler can be attached to the event using one of the following ways, +
+$button->Click=$callback;
+$button->Click->add($callback);
+$button->Click[]=$callback;
+$button->attachEventHandler('Click',$callback);
+
+where $callback refers to a valid PHP callback (e.g. a function name, a class method array($object,'method'), etc.) +

Controls

A control is an instance of class TControl or its subclass. A control is a component defined in addition with user interface. The base class TControl defines the parent-child relationship among controls which reflects the containment relationship among user interface elements.

+

Parent-Child Relationship

+

+A parent control is in charge of the state transition of its child controls. The rendering result of the child controls are usually used to compose the parent control's presentation. +

+

+The parent-child relationship is usually established by the framework via templates. In code, you may explicitly specify a control as a child of another using the following method, +

+$parent->Controls->add($child);
+
+where the property Controls refers to the child control collection of the parent. +

+

Pages

+

+Pages are top-most controls that have no parent (you may consider application as their container though). The presentation of pages are directly displayed to end-users. +

\ No newline at end of file -- cgit v1.2.3