My review of Drupal 6 Attachment Views by J. Ayen Green

Drupal 6 Attachment Views There have already been a couple of glowing reviews of this book recently. But they fail to mention what is so great about it.

Drupal 6 Attachment Views There have already been a couple of glowing reviews of this book recently. But they fail to mention what is so great about it.

The book is great because until someone shows you something, you simply have no idea. Eaton’s famous article and video Photo galleries with Views Attach made people’s jaw drop with an introduction to little known helper modules and views features, and to name a single example from a multitude, the Limiting node view results to author tutorial helped to wake people up to the “provide default argument” in views arguments that allows you to lift node and user ids right out of the URL. And heck, I guess I’ve given a bunch of talks on views too, and written about it. But this book is great because it uncovers and introduces you to all of the possibilities hidden in yet another views dimension: attachment views (attachment displays). And J. Ayen Green writes a book about it!

The book is also fascinating because by hint or by dint it has hit upon a way of showing how you can enormously leverage the dynamic panes and blocks which are the medium of dynamic website applications, providing intelligence to those panes and blocks which would otherwise just be adornments.

Plus the fact that the book goes through the whole process of writing a website application, starting from the requirements up to the finished site, a method for which I got great feedback when I wrote Leveraging Drupal. And the code for the complete website application can be downloaded from Packt Books and the URL is mentioned directly in the books preface. Code you say? We’re talking about views! Well, precisely, a book this strong should emphasize the importance of views as code and views as a code generator, for a variety of reasons. And it does.  The only problem is that the code I downloaded only contains the theme, while it should also include the final code exports from the cck content types, the views themselves and the utility module accompanying the application. Then readers could then start out by simply importing everything and applying the theme and follow along in the book if they like, a tremendous learning tool. This could easily be rectified by Packt books, of course, by simply adding the cck content type and views exports to the downloadable zip file. Alternatively, they or the author could make a tarball of the whole finished site available together with the database dump, that probably would be the ideal.

Of course, the fact that the book is also a great guide to views theming (right down to the PHP $rows variable, complete with the CSS) also makes it a “Drupal book must have”.

BTW, what are attachment views? An attachment view, or view which contains an attachment display, actually, is defined in the book as… well, there is an attempt at a definition in words on page 31, but it is a definition by example only. Fortunately the built in advanced help for views gives a perfect definition:

“Attachment displays are ‘attached’ to another display in the same view. When the display is visited, the attached display will also be rendered and may be placed before, after or both before and after the original display. Attachment displays are often useful for displaying an argument summary view along with a page display that accepts arguments. This can be used to provide a kind of glossary.” (from the Views modules advanced help)

But even if there is no clear scientific definition, by the time you finish working through the book you will definitely know what an attachment view is and what it’s good for.  And it goes through the process ten times with ten different examples which form the building blocks of the overall application, bringing in other general Drupal resources all the whle.

Attachment views form the kernel of the book and its approach, which, together with its thoroughness and multi-dimensional depth, makes it unique to other Drupal books.

“Step by step”

We’ve heard the phrase many times, but this book really takes a newbie from zero to hero. It literally goes step by step (with a screenshot for every step), and thanks to this book, I am sure hordes of people will reach what has been up till now expert level. You can start reading the book without even knowing what a view is (without even knowing what Drupal is, for that matter: the author explains both from the ground up), and end up the guy to go to for views and for Drupal. And the guy who doesn’t hack everything out in PHP, who doesn’t “set the page in stone… bypassing the flexibility that Drupal provides” (p. 31).

Earl Miles, the creator of views, must be happy about this book, because now drupalistas can really get the benefit the maestro intended them to have.