Asynchronous JavaScript and XML (Ajax), is arguably the most popular new Web technology. In this two-part "Developing PHP the Ajax way" series, you will create a simple photo album as an online Web application, entirely in PHP and the Simple Ajax Toolkit (Sajax). You'll begin by writing a simple photo album using the standard method of PHP development and later apply Sajax to make it an active Web application.
Creating a simple photo album
In this article, you will create a simple photo album using two methods: a traditional Web application and a Sajax-powered application. You will write an album in PHP that reads the contents of a directory, showing the user a table of thumbnails. If the user clicks a thumbnail, the image will expand to full size. Since you will be writing a traditional application, every click will be a new HTTP request, with parameters being passed as part of the URL.
You will learn how to quickly apply the Sajax library to your album and find out why using Sajax will speed up application development.
Adding a pager table
A user visiting your album will need to have some way to quickly view your photos. Since many large photos cannot be easily viewed on one page, you need to create a pager -- a simple table that displays a few thumbnail images at a time. You will also write navigation to help the user mover forward and backward through the image list.
Figure 1. Pager will provide way to show user photos