jQuery 1.3 with PHP by Kae Varens is a great book that shows you how to interface jQuery with PHP. It’s different from any other web development book I’ve read because it approaches things from the opposite perspective that I personally am used to – from the server to the client. It’s aimed at competent PHP developers that want to learn how to use jQuery. Strictly speaking I’m outside of the scope of who the book is aimed at, but fortunately I just enough PHP to follow along with the examples and know roughly what is happening in the server-side code. It is made clear very early on who the book is aimed at.
One thing that I really liked about this book was that as well as the strong focus on jQuery throughout (as you’d expect) the author also included not just one, but several different examples of using jQuery UI in conjunction with PHP. jQuery UI is the official UI library for jQuery so I think it’s important that it should be covered in this kind of book, even if only briefly.
The book is broken down into the following chapters:
Chapter 1 eases you into the book with sections on what jQuery is, why you should be using it and how it integrates with PHP. Some popular web applications that use jQuery are looked at and the author shows how to set up a directory structure so that the examples in the book can be replicated.
Chapter 2 covers some quick tips that server-side developers can use in order to help bridge the gap between the client and the server. Examples include how to make select boxes dynamically load options when required, contextual help tips, and inline editing of a page’s content.
Chapter 3 looks at the tabs and accordion widgets from jQuery UI and shows not only how to load their contents dynamically, but also how to create them on the fly with the server. This is a very thorough and detailed chapter and I really liked the code examples here.
Chapter 4 focuses on forms and form validation; it shows how to use the jQuery validation plugin in order to perform some validation on the client before involving the server (such as checking for empty fields which are required), and how to complete the validation on the server. Another code examples shows how to easily create an awesome auto-complete text-field.
Chapter 5 is another very thorough and in-depth chapter dominated by code examples; it shows how to create a file management system that allows for creating, moving and deleting directories on the server and uploading, moving and deleting files. This was probably my favourite chapter of the book.
Chapter 6 shows you how to create an entire calendar application that allows you to add, delete and move events and how recurring events can be handled. This is a great practical chapter that uses some interesting plugins including the jquery-week-calendar and the jQuery UI dialog. The example really highlights how to make these plugins work with server efficiently.
Chapter 7 covers image manipulation such as cropping, resizing and rotating. Jorn Zaefferer’s treeview plugin is used in conjunction with some of the file management app created in chapter 5 to show the images available, while the actual manipulations are performed with the ImageMagick PECL extension.
Chapter 8 looks at the client-side heavy jQuery UI interaction helper sortable; so far the jQuery UI components the book has looked at have all been UI widgets so it’s great that this is included as well. Drag and drop, a very client-side oriented task, is looked at in detail and there is probably less server-side code in this chapter than in any other, which must be incredibly useful for those more used to working with the server.
Chapter 9 looks at displaying large sets of tabular data efficiently and uses the dataTables jQuery plugin to allow pagination, sorting, filtering and column re-ordering. There are some interesting (for me) server-side concepts in this example such as caching and how to load data is small chunks, but a server-side developer would probably know this already. The client-side code examples were quite extensive as well though and would help server-side developers use the dataTable plugin effectively.
The final chapter, chapter 10 looks at a series of examples that show how client-side code can be optimised to improve the user experience; it’s a fast paced chapter with a lot of small examples and contains some real gems of information.
Overall this is a great book with very thorough and well-explained examples and plenty of code that the average server-side developer could take away and reuse. As a front-end developer I’m completely the opposite of who the book is aimed at but it was clear that the descriptions of using jQuery would be of value to PHP developers.