Book Review: Drupal 6 JavaScript and jQuery
This weekend I took the time to get stuck into one of Packt Publishing's Drupal titles, Drupal 6 JavaScript and jQuery. In this book, Matt Butcher takes the reader through the basics of using JavaScript within Drupal themes and modules, with a heavy emphasis on the all popular jQuery library.
I should probably start out by saying that I know Drupal pretty well and have created an array of custom modules and themes, some of which I have released on drupal.org. Whilst some of these modules and themes do use limited JavaScript, I am still yet to dive head first into the the area of Drupal and JavaScript, and was excited to see what this book had to say on the topic. After all, it is through mainly through clever use of JavaScript and server-side technologies that today's websites can gain such a level of interactivity.
Reader prerequisites
In Drupal 6 JavaScript and jQuery the reader is expected to have a basic knowledge of the operation of Drupal, and to be familiar with the concept of themes and modules in Drupal. No experience of creating Drupal themes or modules is required or expected, and the practicality of each of these areas is addressed as the need arises throughout the book.
Starting out
Chapter 1 covers the core technologies that make up Drupal (PHP, SQL, HTML, CSS, XML and of course Javascript), the Drupal architecture (the Drupal Core, modules and themes), users, nodes and blocks, as well as a handful of what I consider to be essential developer tools such as Firebug. If you are a seasoned Drupal developer you can probably safely skip over this chapter, although it it is quite short and concise so you might do just as well to give it the 10 minutes it deserves.
Moving on
Moving on to chapter 2, you are taken through the basics of working with JavaScript in Drupal. This covers an overview of how JavaScriupt works in Drupal as well as detailed step by step instructions for getting up and running with your first 'hello world!' JavaScript script running from within Drupal.
Chapter 3 covers jQuery and how to use it within Drupal, whilst chapters 4, 5, 6 and 7 cover the use of Drupal's own JavaScript library, drupal.js. This library is incredibly useful for Drupal developers and in my opinion the author has done well to devote such a chunk of the book to it.
Each chapter uses a well thought out example based approach and in every chapter, the book will:
- Introduce any new concepts that are key to understanding the chapters content.
- Introduce an example project and clearly state its goals and objectives.
- Explain how the author intends to go about solving the problem.
- Explain step-by-step how to complete the project, from start to finish with lots of screenshots, tips, and explanations of important concepts along the way.
Each of the example projects is presented in such a way that is easy to follow and often quite compelling to read. The example projects start off short and sweet, but as the book progresses and the techniques used become more familiar, these short projects gradually build up to much longer and possibly more useful ones.
Towards the end of the book the author chooses to present fairly large chunks of code right from the onset of a project, using the remainder of the chapter to break it down step by step and explain exactly what each part of the puzzle is doing. I quite liked this approach as it gave me a chance to first try and work out for myself what was being done by reading and interpreting the code. The explanations that follow are detailed and comprehensive, often dotted with additional notes and useful tips.
Example projects
The example projects covered in the book range from a simple 'hello world!' project to much more complex and feature rich projects such as a real time comment watcher and notifier. The list of projects includes:
- Hello world!
- Printer-friendly page content
- Rotating sticky node teasers
- Collapsing blocks
- Simple text editor
- Creating and using templates for JavaScript
- Web clips with RSS and AJAX
- Real-time comment notifications
- Autocompletion and search
- Writing a jQuery plugin
From start to finish, projects get progressively more complicated, with each example building on the knowledge that was gained from those prior to it. I found some projects more compelling to read than others as I could see more real world usage examples for the end product, However, each project does have a specific goal, which is generally to introduce a new concept and to help the reader to understand how JavaScript can be used to build an appropriate solution within Drupal.
Finishing up
As someone who has worked with Drupal fairly extensively, I have certainly come out the other end armed with more than I started with. I must say that I had hoped that this book would cover some of the slightly more advanced JavaScript techniques that make it possible to create interactive user interfaces more akin to to those of the Views or Panels, but I guess that is a little outside the scope of the book and is not what the author had intended. Instead, he has left the reader with a strong foundation to build upon and take to the next level at their own pace.
Read an Excerpt Chapter
In order to help promote the book, Packt Publishing has provided a free download of Drupal 6 JavaScript and jQuery’s second chapter: Working with JavaScript in Drupal.
LATEST ARTICLES
TODAY'S MOST POPULAR
-
8th Aug 08
-
4th Sep 08
-
4th Aug 08
MOST POPULAR ARTICLES
RECENT COMMENTS
-
17 hours 11 min ago
-
3 days 6 hours ago
-
3 days 11 hours ago
-
3 days 17 hours ago
-
4 days 10 hours ago

Please share your thoughts, comments and suggestions...