From dd028bec3822d1d9c28c35d599d687e038c7705f Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 4 Jan 2007 11:23:26 +0000 Subject: Add chat demo and tutorial. --- .../protected/pages/Tutorial/AjaxChat.page | 753 +++++++++++++++++++++ .../pages/Tutorial/CurrencyConverter.page | 4 +- .../quickstart/protected/pages/Tutorial/chat1.png | Bin 0 -> 10533 bytes .../quickstart/protected/pages/Tutorial/chat2.png | Bin 0 -> 13409 bytes 4 files changed, 755 insertions(+), 2 deletions(-) create mode 100644 demos/quickstart/protected/pages/Tutorial/AjaxChat.page create mode 100644 demos/quickstart/protected/pages/Tutorial/chat1.png create mode 100644 demos/quickstart/protected/pages/Tutorial/chat2.png (limited to 'demos/quickstart/protected/pages/Tutorial') diff --git a/demos/quickstart/protected/pages/Tutorial/AjaxChat.page b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page new file mode 100644 index 00000000..3a17b5d4 --- /dev/null +++ b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page @@ -0,0 +1,753 @@ + +

Building an AJAX Chat Application

+

This tutorial introduces the Prado web application framework's + ActiveRecord + and Active Controls to build a Chat + web application . It is assumed that you + are familiar with PHP and you have access to a web server that is able to serve PHP5 scripts. + This basic chat application will utilizing the following ideas/components in Prado. +

+

+ +

In this tutorial you will build an AJAX Chat web application that allows + multiple users to communicate through their web browser. + The application consists of two pages: a login page + that asks the user to enter their nickname and the main application chat + page. + You can try the application locally or at + Pradosoft.com. + The main application chat page is shown bellow. + class="figure" /> +

+ +

Download, Install and Create a New Application

+

The download and installation steps are similar to those in + the Currency converter tutorial. + To create the application, we run from the command line the following. + See the Command Line Tool + for more details. + +php prado/framework/prado-cli.php -c chat + +

+ +

The above command creates the necessary directory structure and minimal + files (including "index.php" and "Home.page") to run a Prado web application. + Now you can point your browser's url to the web server to serve up + the index.php script in the chat directory. + You should see the message "Welcome to Prado!" +

+ +

Authentication and Authorization

+

The first task for this application is to ensure that each user + of the chat application is assigned with a unique (choosen by the user) + username. To achieve this, we can secure the main chat application + page to deny access to anonymouse users. First, let us create the Login + page with the following code. We save the Login.php and Login.page + in the chat/protected/pages/ directory (there should be a Home.page + file there create by the command line tool). +

+ +<?php +class Login extends TPage +{ +} +?> + + + + + + Prado Chat Demo Login + + +<com:TForm> +

Prado Chat Demo Login

+