Pro PHP and jQuery |
Author: Jason Lengstorf
A book that deals with PHP and jQuery used in combination is likely to meet a lot of people's requirements. Author: Jason Lengstorf Publisher: Apress, 2010 Pages: 400 ISBN:978-1430228479 Aimed at:Intermediate PHP and Javascript developers Rating: 3.5 Pros: Good idea to combine jQuery and PHP Cons: Fails to explain principles of using the two together Reviewed by: Ian Elliot
This is an interesting idea for a book. PHP is a very popular server side language and it tends to be used without the help of a framework. Javascript on the other hand is very commonly used with a framework and jQuery is one of the front runners. Hence a book that deals with PHP and jQuery used in combination meets a lot of people's requirements. 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. This isn't a bad book but it misses the opportunity to tackle some of the problems that every web developer suffers from when trying to make PHP and Javascript work together. Ajax for example needs planning and co-ordination on both sides of the divide - client and server. Rather than making any big general points about such interoperation, the book simply provides a big example with "this is how it is done" as the main comment. 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.
|
|||
Last Updated ( Monday, 25 October 2010 ) |