Author: Jason Lengstorf
Publisher: Apress, 2010
Pros: Good idea to combine jQuery and PHP
Cons: Fails to explain principles of using the two together
Reviewed by: Ian Elliot
Even if you use a PHP CMS like Joomla much of the same programming advice and techniques apply as using raw PHP. The whole idea is best described by the subtitle to the book: Add quick, smooth and easy interactivity to your PHP sites with jQuery. You could just write a book on bolting on jQuery to an existing site but this would ignore the benefits of a coherent design that makes use of both the front and back ends working together.
Part one is a basic introduction to jQuery, It covers all you need to know about using jQuery to find elements in the DOM and basically manipulate them. It also covers animation, events and Ajax. It's not a bad introduction but occasionally it fails to provide clear explanation of the concepts that are behind the scenes. For example, selectors and filters are described but the difference between them is left for the reader to deduce from examples. It would have been more helpful to add a sentence or two that explained how it all fitted together.
Part 2 focuses on PHP programming and while it is titled "Advanced PHP Programming" it is mostly about object oriented PHP. Most of the space is taken up with a long example of an events calendar, all built in object-oriented style. It also demonstrates the basic ideas of generating HTML and using CSS to determine what that code looks like.
At the end of Part 2 we have a more or less complete PHP application with virtually no client side processing, if you discount submit buttons etc. Part 3 deals with adding jQuery to the mix. Here the idea is progressive enhancement. First to be added is a pop-up modal window. From here we quickly get into the details of using Ajax to update the calendar. Part 4 is more of the same but this time "advanced". The topics covered are a bit disappointing - how to perform validation with regular expressions is interesting but not really advanced. The final chapter is on extending jQuery which is fine but it could equally well be in a book devoted just to jQuery rather than one that is supposed to be more about using jQuery with PHP.
Overall because this book is so heavily dependent on an example it is difficult to criticise it because the example code is very long. However, there are lots of places you are likely to struggle with keeping in mind how it all works together - but then again this is realistic.
If you are looking for a book that takes you a bit further in your use of PHP and introduces jQuery and you like big examples, then this is a book you might like to read. If on the other hand you are looking for a book that tells you how to use the two together in terms of principles and grand ideas this isn't it. Perhaps it's just too difficult a book to write.