Apr 14, 2009

Prado Framework


Prado Framework New Features

This page summarizes the main new features that are introduced in each PRADO release.
Version 3.1.3

* Added Drag and drop controls
* Added TActiveDatePicker control

Version 3.1.2

* Added a new active control TActivePager that allows to paginate a databound control with an ajax callback.
* Added TFirebugLogRoute to send logs to the Firebug console

Version 3.1.1

* Added a new control TTabPanel that displays tabbed views.
* Added a new control TKeyboard that displays a virtual keyboard for text input.
* Added a new control TCaptcha that displays a CAPTCHA to keep spammers from signing up for certain accounts online. A related validator TCaptchaValidator is also implemented.
* Added a new control TSlider that displays a slider which can be used for numeric input.
* Added a new control TConditional that conditionally displays one of the two kinds of content.
* Added Oracle DB support to Active Record.
* Added support to TDataGrid to allow grouping consecutive cells with the same content.
* Added support to allow configuring page properties and authorization rules using relative page paths in application and page configurations. Added support to allow authorization based on remote host address.
* Added a new page state persister TCachePageStatePersister. It allows page state to be stored using a cache module (e.g. TMemCache, TDbCache, etc.)
* Added support to the auth framework to allow remembering login.
* Added support to display a prompt item in TDropDownList and TListBox (something like 'Please select:' as the first list item.)
* Added support to column mapping in Active Record.

Version 3.1.0

* Added seamless AJAX support. A whole array of AJAX-enabled controls, called active controls, are introduced. The usage of these active controls is very similar to their non-AJAX counterparts, i.e., plug in and use. For more details, see the tutorial about active controls.
* Added complete database support.
* Added new controls, modules and services, including TSoapService, TOutputCache, TSessionPageStatePersister, TFeedService, TJsonService, cache dependency classes, TXmlTransform.
* Enhanced some data controls with renderers. Renderer enables reusing item templates that are commonly found in TRepeater, TDataList and TDataGrid, and makes the configuration on these controls much cleaner. For more details about renders, see the updated tutorials on TRepeater, TDataList and TDataGrid.
* Added support to allow including external application configurations. Enhanced template syntax to facilitate subproperty configuration.
* Added TDbUserManager and TDbUser to simplify authentication and authorization with user accounts stored in a database.

More info please, visit: Prado Framework Homepage

Apr 5, 2009

License of PRADO

The PRADO framework and the included demos are free software. They are released under the terms of the following BSD License.

Copyright 2004-2007 by The PRADO Group (http://www.pradosoft.com)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the PRADO Group nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRADO 3.1.4 is released

We are proud to announce the release of PRADO 3.1.4. In this release have included about twenty bug fixes and minor feature enhancements. For more details, please check the change log on the download page. Upgrading to this new release should be safe.
Visit Prado FrameWork Homepage at http://www.pradosoft.com/

Oct 7, 2006

PRADO PHP Framework, What is PRADO ?


PRADO is a component-based and event-driven programming framework for developing Web applications in PHP 5. PRADO stands for PHP Rapid Application Development Object-oriented.
A primary goal of PRADO is to enable maximum reusability in Web programming. By reusability, we mean not only reusing one's own code, but also reusing other people's code in an easy way. The latter is more important as it saves the effort of reinventing the wheels and may cut off development time dramatically. The introduction of the concept of component is for this purpose.

To achieve the above goal, 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 created by simple composition of existing components.

To facilitate interacting with components, PRADO implements an event-driven programming paradigm that allows delegation of extensible behavior to components. End-user activities, such as clicking on a submit button, 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.
In summary, 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.


Why PRADO?


PRADO is mostly quoted as a unique framework. In fact, it is so unique that it may turn your boring PHP programming into a fun task. The following list is a short summary of the main features of PRADO,

  • Reusability - Code following the PRADO component protocol are highly reusable. Everything in PRADO is a reusable component.
  • Event-driven programming - End-user activities, such as clicking on a submit button, are captured as server events so that developers have better focus on dealing with user interactions.
  • Team integration - Presentation and logic are separately stored. PRADO applications are themable.
  • Powerful Web controls - PRADO comes with a set of powerful components dealing with Web user interfaces. Highly interactive Web pages can be created with a few lines of code. For example, using the datagrid component, one can quickly create a page presenting a data table which allows paging, sorting, editing, and deleting rows of the data.
  • I18N and L10N support - PRADO includes complete support for building applications with multiple languages and locales.
  • Seamless Ajax support - PRADO provides a set of Ajax-enabled components that can be easily used (to be available in v3.1).
  • XHTML compliance - Web pages generated by PRADO are XHTML-compliant.
  • Accommodation of existing work - PRADO is a generic framework with focus on the presentational layer. It does not exclude developers from using most existing class libraries or toolkits. For example, one can AdoDB or Creole to deal with DB in his PRADO application.
  • Other features - Powerful error/exception handling and message logging; generic caching and selective output caching; customizable and localizable error handling; extensible authentication and authorization; security measures such as cross-site script (CSS) prevention, cookie protection, etc.

What Is PRADO Best For?

PRADO is best suitable for creating Web front-ends that are highly user-interactive and require small to medium traffic. It can be used to develop systems as simple as a blog system to systems as complex as a content management system (CMS) or a complete e-commerce solution. PRADO can help you cut your development time significantly.

PRADO does not exclude other back-end solutions such as most DB abstraction layers. In fact, they can be used like what you usually do with traditional PHP programming.

Without caching techniques, PRADO may not be suitable for developing extremely high-traffic Web applications, such as popular portals, forums, etc. In these applications, every niche of potential performance gain must be exploited and server caching (e.g. Zend optimizer) is almost a must. PRADO implements a generic cache technique and enables selective caching of part of Web contents.


How Is PRADO Compared with Other Frameworks?

PRADO is described as a unique framework. Its uniqueness mainly lies in the component-based and event-driven programming paradigm that it tries to promote. Although this programming paradigm is not new in desktop application programming and not new in a few Web programming languages, PRADO is perhaps the first PHP framework enabling it.

Most PHP frameworks are trying to establish a loose standard of organizing PHP programming, most preferably the MVC (model-view-controller) model. It is difficult to compare PRADO with these frameworks because they have different focuses. What we can say is, PRADO is more like a high-level language built upon PHP, while the MVC frameworks stand for the best programming practices. Both aim to help developers to rapidly complete Web application development. The advantage of PRADO is its rich set of prebuilt powerful components and extreme reusability of the PRADO code, while the advantage of the MVC frameworks is the complete separation of model, view and controller, which greatly facilitates team integration.

History of PRADO

The very original inspiration of PRADO came from Apache Tapestry. During the design and implementation, I borrowed many ideas from Borland Delphi and Microsoft ASP.NET. The first version of PRADO came out in June 2004 and was written in PHP 4. Driven by the Zend PHP 5 coding contest, I rewrote PRADO in PHP 5, which proved to be a wise move, thanks to the new object model provided by PHP 5. PRADO won the grand prize in the Zend contest, earning the highest votes from both the public and the judges' panel.

In August 2004, PRADO started to be hosted on SourceForge as an open source project. Soon after, the project site xisc.com was announced to public. With the fantastic support of PRADO developer team and PRADO users, PRADO evolved to version 2.0 in mid 2005. In this version, Wei Zhuo contributed to PRADO with the excellent I18N and L10N support.

In May 2005, we decided to completely rewrite the PRADO framework to resolve a few fundamental issues found in version 2.0 and to catch up with some cool features available in Microsoft ASP.NET 2.0. After nearly a year's hard work with over 50,000 lines of new code, version 3.0 was finally made available in April 2006.

Starting from version 3.0, significant efforts are allocated to ensure the quality and stability of PRADO. If we say PRADO v2.x and v1.x are proof-of-concept work, we can say PRADO 3.x has grown up to a project that is suitable for serious business application development.

PRADO Component

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 PRADO

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 define its ID property using the following getter and setter methods,

class TControl extends TComponent {  
public function getID()
{
...
}

public function setID($value)
{
...
}
}

To get or set the ID property, do as follows, just like working with a variable,

$id = $component->ID; $component->ID = $id;
This is equivalent to the following,
$id = $component->getID(); $component->setID( $id );

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.

Subproperties

A subproperty is a property of some object-typed property. For example, TWebControl has a Font property which is of TFont type. Then the Name property of Font is referred to as a subproperty (with respect to TWebControl).

To get or set the Name subproperty, use the following method,

$name = $component->getSubProperty('Font.Name'); $component->setSubProperty('Font.Name', $name);
This is equivalent to the following,
$name = $component->getFont()->getName();
$component->getFont()->setName( $name );

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 a method whose name starts with the word on. The event name is the method name and is thus case-insensitve. For example, in TButton, we have

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

Namespaces

A namespace refers to a logical grouping of some class names so that they can be differentiated from other class names even if their names are the same. Since PHP does not support namespace intrinsically, you cannot create instances of two classes who have the same name but with different definitions. To differentiate from user defined classes, all PRADO classes are prefixed with a letter 'T' (meaning 'Type'). Users are advised not to name their classes like this. Instead, they may prefix their class names with any other letter(s).

A namespace in PRADO is considered as a directory containing one or several class files. A class may be specified without ambiguity using such a namespace followed by the class name. Each namespace in PRADO is specified in the following format,

PathAlias.Dir1.Dir2
where PathAlias is an alias of some directory, while Dir1 and Dir2 are subdirectories under that directory. A class named MyClass defined under Dir2 may now be fully qualified as PathAlias.Dir1.Dir2.MyClass.

To use a namespace in code, do as follows,

Prado::using('PathAlias.Dir1.Dir2.*');
which appends the directory referred to by PathAlias.Dir1.Dir2 into PHP include path so that classes defined under that directory may be instantiated without the namespace prefix. You may also include an individual class definition by
Prado::using('PathAlias.Dir1.Dir2.MyClass');
which will include the class file if MyClass is not defined.

Component Instantiation

Component instantiation means creating instances of component classes. There are two types of component instantation: static instantiation and dynamic instantiation. The created components are called static components and dynamic components, respectively.

Dynamic Component Instantiation

Dynamic component instantiation means creating component instances in PHP code. It is the same as the commonly referred object creation in PHP. A component can be dynamically created using one of the following two methods in PHP,

$component = new ComponentClassName; $component = Prado::createComponent('ComponentType');
where ComponentType refers to a class name or a type name in namespace format (e.g. System.Web.UI.TControl). The second approach is introduced to compensate for the lack of namespace support in PHP.

Static Component Instantiation

Static component instantiation is about creating components via configurations. The actual creation work is done by the PRADO framework. For example, in an application configuration, one can configure a module to be loaded when the application runs. The module is thus a static component created by the framework. Static component instantiation is more commonly used in templates. Every component tag in a template specifies a component that will be automatically created by the framework when the template is loaded. For example, in a page template, the following tag will lead to the creation of a TButton component on the page,

<com:TButton Text="Register" />

Installing PRADO PHP

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.

Installation of PRADO mainly involves downloading and unpacking.

  1. Go to pradosoft.com to grab the latest version of PRADO.
  2. Unpack the PRADO release file to a Web-accessible directory.

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/prado/demos/. Here we assume PRADO is unpacked to the prado subdirectory under the DocumentRoot of the Web server.

If you encounter any problems with the demo applications, please use the PRADO requirement checker script, accessible via http://web-server-address/prado/requirements/index.php, to check first if your server configuration fulfills the conditions required by PRADO.