Review: Drupal 5 Views Recipes

It's curious that Drupal 5 Views Recipes is a brand new book, right? Drupal 6 has been available for nearly a year and Drupal 7 is just a few months away, why bother with a book about Drupal 5? The reason they give in the introduction is that there are still a lot of Drupal 5 sites out there so let's all observe a moment of silence for them. Aum. Aum. Back? There's another reason, this book has a lot of great ideas about using views, ones which could be translated to Drupal 6 if you're so fortunate as to be using the current Drupal. But if you're on Drupal 6 this book won't be terribly helpful, and instead serve more to bring back perhaps unwanted memories of the past. It's sad that for an otherwise good book it has to be saddled with the question of "why would I possibly want this", but there it is.

With that out of the way.. what about the book? It's in the format of a long series of "recipes" that are brief to-the-point discussions about implementing a particular idea. In this case the overall topic is the use of Views (and CCK) within a Drupal 5 site.

Let's first discuss just what is Views and CCK. If you're running a Drupal site these two contributed modules are without a doubt the top-most items for you to install and learn how to use. They add tremendous flexibility to Drupal allowing you to do amazing things with a few clicks of the mouse. While Drupal 5 Views Recipes focuses on the Views module, it does discuss the CCK modules extensively, and the two do go together like hand and glove.

CCK makes it trivially easy to create content types that have more fields than just the title and body. CCK stands for Content Construction Kit, and that's what it does, it lets you construct custom content types based on a list of fields. For example consider constructing an "event calendar". Event announcements have a title (name), description, location, contact information, date (possibly a date range), and perhaps a URL for more information. You could cram all that into the body of a node but it doesn't make for a very pretty calendar. The ideal is for the calendar to look like a calendar, you know, months, days, weeks, that kind of thing, and to have event titles on the calendar such that clicking on the title takes you to the event announcement. With CCK you can create an Event content type and add individual fields for each of those separate pieces of data. Further each field can be typed appropriate to the need, meaning the date field(s) can know that they are date fields and do validation that the date is a valid date.

Views offers an extremely flexible query system to pluck data out of a Drupal site and display it in any which way you want. A view can select nodes based on their attributes, and select for display only given fields of each selected node. There are many alternatives for views display formatting from node lists (like the default front page river of news) to tables and even proper calendar oriented display. Together Views and CCK make Drupal seem something like a database, with CCK providing the tables and Views providing the query system.

The book contains 94 recipes that run the full gamut of simple to complex things which can be done with Views. For each one the requirements are listed up front, followed by a few paragraphs of discussion, and finished with a list of bullet points giving specific things to watch for. Most of the recipes are useful and valuable, and there is much one can learn from this book.

For example Drupal core includes a the Tracker module which gives a list of recent postings. It's very useful for seeing latest activity on the site especially on a busy community site. With the Views module it's easy to create a similar page and customize it to your precise needs. There are three recipes in this book covering that specific task.

An interesting aspect of this book is that many times it recommends modules which are not in the contributed modules on drupal.org. It's surprising to me to learn there are many useful modules which are not hosted as a drupal.org contributed module.

Again this is a well written book and recommended if you are (stuck) on Drupal 5. Otherwise I can't find it in my heart to recommend this book.