-------------------
PRADO v1.7 Tutorial
-------------------
Qiang Xue
qiang.xue@gmail.com
--------------------
Copyright 2004.
All Rights Reserved.
Getting started
~~~~~~~~~~~~~~~
* What is PRADO?
~~~~~~~~~~~~~~~~
PRADO is an event-driven and component-based framework for developing Web
applications in PHP 5. 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.
Let's use a simple example to describe the power of the PRADO framework.
Assume we want to develop a "login page" with PRADO. We will use two
<<<TTextBox>>> components and one <<<TButton>>> component to represent the
username input, the password input, and the submit button, respectively. We
set the <<<TextMode>>> property of the password component to <<<Password>>>,
and attach a <<<login>>> function to the <<<OnClick>>> event of the button.
A fully functional "login page" is then established by putting these
components onto the page template at appropriate locations. The components
will take care of the issues such as how to display to the user and how to
fetch the data from the user and respond to his/her actions. For example,
the <<<TTextBox>>> components will show input fields to the user; the text
entered into the password field will be hidden and can be fetched via the
<<<Text>>> property of the corresponding <<<TTextBox>>> component in code;
and when the user clicks on the submit button, the <<<login>>> function will
be automatically invoked. This is very different from traditional PHP
programming processes in which developers are responsible for displaying the
HTML tags of the input fields and the button, and they also need to
interpret the form POST data to get the user input and determine whether the
button is clicked.
PRADO enables the ultimate reusability of code by its protocol for defining
and using components. Some repetitive and tedious work, such as form field
validation and page state management, can be handled using the provided
PRADO components. Developers can also develop new components by either
inheriting or composing from existing components, and the new components are
ready to distribute.
In summary, PRADO provides the following benefits for PHP programmers:
* <<Reusability>> - Codes following the PRADO component protocol are
highly reusable.
* <<Ease of use>> - Using PRADO components are extremely easy. Usually
they simply involve configuring component properties and writing event
handlers.
* <<Robustness>> - PRADO frees developers from writing boring, buggy
code. They code in terms of objects, methods and properties, instead
of URLs and query parameters. The latest PHP5 exception mechanism is
exploited that enables line-precise error reporting.
* <<Performance>> - PRADO applications are fast. PRADO implements a
caching technique that allows the performance of PRADO applications to
be comparable to those based on commonly used template engines.
* <<Team integration>> - PRADO enables separation of content and
presentation. Components, typically pages, have their content (logic)
and presentation stored in different files. The introduction of module
concept facilitates task division and centralization of logic and
data.
There are many PHP frameworks currently. Mojavi, WACT and many other
frameworks (such as PHP.MVC, Phrame) mainly try to establish a loose
standard of organizing PHP programming (such as model-view-controller). Some
of them are more oriented to developing content management systems and thus
provide additional functionalities such as user management modules etc.
Compared with these frameworks, PRADO focuses more on establishing a
standard of reusing codes and event-driven programming. If you have
experience with Windows programming using Visual Basic or Delphi, you will
find Web programming with PRADO is very similar. Most of the time, you only
need to set component properties and respond to component events. Higher
level of code reusability, such as the aforementioned user management
module, can be achieved based on PRADO components.
The idea of PRADO was first inspired by the Apache Tapestry project. During
its design and implementation, Borland Delphi and Microsoft ASP.NET play a
very important role in helping me think and design. In fact, people having
experience with ASP.NET may find a lot of similar aspects in PRADO.
* Installation
~~~~~~~~~~~~~~
PRADO requires PHP 5 with SimpleXML extension. It has been tested on Windows
XP and RedHat Linux with Apache httpd and Microsoft IIS Web servers.
The framework is distributed in a <<<.zip>>> file. You can unpack it using
<<<unzip>>> on Linux or <<<WinZip>>> on Windows.
After the file is unpacked, a directory named <<<prado>>> will be created
under the current directory. The directory mainly contains the following
files and directories,
------------------------------------------------------------------------------
README.html the readme file for this project
index.html this has the same content as README.html
COPYRIGHT copyright information for this project
HISTORY version update information
framework/ the core code of PRADO framework
examples/ several PRADO examples
docs/ PRADO documentation
------------------------------------------------------------------------------
Now copy everything in <<<prado>>> to the root directory of the Web server.
You can also put these files in a subdirectory of the root directory, but
you will have to change the URLs for visiting the following PRADO examples
accordingly.
You are done with the installation! You can now try out the four examples
included in the PRADO distribution, "Hello, world!", the Hangman Game, the
PRADO Phonebook and the PRADO Blog by the following URLs, respectively,
* "Hello, world!" --
<<<http://\<Web-server-address\>/examples/helloworld.php>>>
* the Hangman game --
<<<http://\<Web-server-address\>/examples/hangman.php>>>
* the PRADO phonebook --
<<<http://\<Web-server-address\>/examples/phonebook.php>>>
* the PRADO blog --
<<<http://\<Web-server-address\>/examples/blog.php>>>
* Example: Hello, World!
~~~~~~~~~~~~~~~~~~~~~~~~
In this section, we describe the "Hello, world!" example to give you a sense
of PRADO application development. The example is very simple. It has only
one page that displays a click button with "Click me" text on it. When user
clicks on the button, the text will change to "Hello, world!".
We will need the following files for this task,
* <<<helloworld.php>>>, the main entry to the application;
* <<<helloworld/application.spec>>>, the application specification file;
* <<<helloworld/HomePage.php>>>, the page class file;
* <<<helloworld/HomePage.tpl>>>, the page template file.
Note, the <<<helloworld>>> directory should be configured inaccessible to
end-users because it contains sensitive application information.
In the <<<helloworld.php>>> file, we mainly instantiate the
<<<TApplication>>> class and starts the application, as shown in the
following,
--------------------------------------------------
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
svnmanager用户权限管理 (2000个子文件)
build.bat 42B
COPYRIGHT 2KB
prado.COPYRIGHT 2KB
COPYRIGHT 2KB
site.css 7KB
calendar-win2k-2.css 6KB
calendar-win2k-1.css 6KB
calendar-win2k-cold-2.css 6KB
calendar-win2k-1.css 6KB
calendar-win2k-cold-2.css 6KB
calendar-win2k-2.css 6KB
calendar-win2k-1.css 6KB
calendar-win2k-2.css 6KB
calendar-win2k-cold-2.css 6KB
calendar-win2k-cold-1.css 6KB
calendar-win2k-cold-1.css 6KB
calendar-win2k-cold-1.css 6KB
calendar-system.css 6KB
calendar-system.css 6KB
calendar-system.css 6KB
calendar-tas.css 5KB
calendar-tas.css 5KB
calendar-tas.css 5KB
calendar-blue2.css 5KB
calendar-blue2.css 5KB
calendar-blue2.css 5KB
calendar-blue.css 5KB
calendar-blue.css 5KB
calendar-blue.css 5KB
calendar-green.css 5KB
calendar-green.css 5KB
calendar-green.css 5KB
calendar-brown.css 5KB
calendar-brown.css 5KB
calendar-brown.css 5KB
reference-Z-S.css 4KB
reference-Z-S.css 4KB
editor_ui.css 3KB
editor_ui.css 3KB
editor_ui.css 3KB
editor_popup.css 2KB
editor_popup.css 2KB
editor_popup.css 2KB
editor_ui.css 2KB
editor_ui.css 2KB
editor_ui.css 2KB
editor_ui.css 2KB
editor_ui.css 2KB
editor_ui.css 2KB
reference.css 2KB
reference.css 2KB
reference.css 2KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
style.css 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- nsauska2014-06-09还行。。。。。。
- 草木灰—CRL2018-06-27这是个锤子
grcgao
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功