Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Creating a chat script with PHP and Ajax (Part 2)
Apr 04, 2006 @ 07:09:48

PHPit.net is following up This previous article with the next in the series today - Part Two of "Creating a chat script with PHP and Ajax".

Welcome to the second part of the 'Creating a chat script with PHP and Ajax' series. It's been a while since the previous part, and much has happened since then. 37Signals, a very popular "web 2.0" company, has released a web application called Campfire which is actually a chat script based on Ajax and Ruby on Rails, and it has many of the features we'll be implementing in this article series.

In this part we'll start from scratch again, but this time we'll start with a solid structure. Unlike the previous part, which was more or less a hack job, we'll start using JSON and several other libraries to make everything easier for us. I will also show you how to add a few more features, like a user list.

It's definitely good to see that they aren't just building on the previous structure, but setting asside time to really plan out the application before getting started. Instead of hacking together an application that "works, but just barely", they opt for using solid libraries like ADOdb and Prototype for the power behind the scenes.

Right off the bat, they show you how to set up the filesystem structure, the database structure, and the basic framework of PHP code for the client to interface with. From there, it's just the creation of the other pieces of the puzzle - the interface, functions to handle the login form, and a method to ping the server for new messages, and, of course, the backend to handle it all.

tagged: create chat script ajax adodb prototype json-php create chat script ajax adodb prototype json-php