Skip to main content

Book Review: Drupal 6 JavaScript and jQuery

Drupal 6 JavaScript and jQuery
Author Matt Butcher
Publisher Packt Publishing / Birmingham
First published February 2009
Pages 319
ISBN 978-1-847196-16-3
List price €30.99 (Ordering / Product information)

When I first read the title of the book, my thoughts were "Oh great, two nested niche topics, only specialists could be interested in. Nobody without a strong technical background in the field will be able to understand it". I'm glad to say, that my first impression was utterly wrong.

JavaScript has come a long way from being more or less a toy programming language for adding fancy effects, to making a website almost feel like a Desktop application. Today, JavaScript is what makes it possible to interact with a page in a way, that doesn't require the browser to send every user action to the web server in order to retrieve an updated version of that page. Collapsing text, drag and drop placement of visual elements and much more can nowadays be done without forcing the user through waiting for a full page reload.
"Drupal 6 JavaScript and jQuery" explains how theme and module developers can harvest the power of JavaScript and especially the jQuery library to make websites feel smoother and more responsive, thus enhancing the user experience.

Structure and content

The book starts off with the obligatory introduction of tools and concepts in chapter one. Chapter two (reading sample) then offers a first glimpse of the power of standalone JavaScript, by showing how it can be used for rendering a given page into a printer friendly version and how to create a custom theme, containing this new functionality.
The next two chapters deal with outlining the basic features of jQuery and Drupal's very own JavaScript library respectively, finalizing the knowledge base, the rest of the book will build upon.

Translations and theming are the core topics of chapters five and six. These are simply a must read for everyone, who is interested into publishing own, JavaScript enabled projects on the drupal.org website, as no module or theme without proper localization support is likely to gain any widespread acceptance.

Chapter seven finally leaves the realm of pure client side Javascript and dives into the world of AJAX and JSON. Here, Matt Butcher describes how to utilize RSS feeds and the Views module as a datasource for automatic page updates and how to implement polling.

In all early chapters of the book, Javascript is simply hooked into the theme layer. However, this is not the only place, where it may live inside of Drupal. When functionality becomes useful regardless of theme, it should be phased out and moved into a module. How this is done exactly, is demonstrated in chapter eight by enhancing standard HTML text area forms with text editor capabilities.

Last but not least, the final chapter talks about advanced topics, such as autocomplete text fields and the jQuery UI library, which will further blur the distinction between website and desktop application by using interactive widgets.

Conclusion

"Drupal 6 JavaScript and jQuery" has a clear structure and is written in an easy to read language. In order to make use of this book, one should be familiar with installing and configuring Drupal. Knowledge of JavaScript, CSS and HTML is not required beyond a basic level, in order to understand the given code examples. However, of course, additional literature is still needed for actually learning these techniques.

I would recommend this book to anyone, who is looking into starting development of own Drupal themes and/or modules.