Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?
Books Book Reviews

Drupal 6 Attachment Views 35

Trevor James writes "Green's book is without a doubt the definitive practical guide to using the Views 2.x module in Drupal 6, and to creating complex and dynamic page, block, and attachment-based views for your Drupal site. One big plus to this book's structure is that Green uses a real "live" production website project as a guide (he states early on that he was working on the site build for the client while writing the book and that the client approved of using the site build as the book's main example) — all of the chapters and subsequent tutorials are focused on building a site for a company that specializes in hiring out contractors and subcontractors. It's nice to see real-world examples being used in a computer tutorial book, especially one focused on Drupal and Drupal Views. The data Green is accessing is real data and this helps to engage the reader and show the multitude of real situations that a developer will get involved with when developing Drupal Views." Read on for the rest of Trevor's review.
Drupal 6 Attachment Views
author J. Ayen Green
pages 300
publisher Packt
rating 9/10
reviewer Trevor james
ISBN 1849510806
summary If you are a Drupal developer of any level and you are waiting to explore Attachment Views, then this book is for you.
Green introduces us to Drupal 6.x Views in Chapter 1 by creating a page View. Green points out how a Views panel relates directly to the SQL statements being run on the backend by Drupal, something I have not seen done in any online tutorial or book — he maps out the panel View and shows, for example, that the Sort Criteria in your Views interface matches your SQL "ORDER BY" statements. A nice touch.

Green also shows us how to Analyze the views we create to test their configuration before previewing the View. This is another trick I was not aware of (and I use Views heavily in the work I do) so I'll emphasize here that the book covers the Views interface exhaustively. Every detail of the interface and building page and attachment Views is covered. Green tackles building Views using Arguments in both Chapters 1-2 and does it in a method that demystifies Arguments and makes them much easier to understand.

The book shows methods of leveraging the Views interface to preview your View data and content without having to leave the Views screen — in chapter 2 Green shows us how to test our attachment View by previewing the Arguments we've added directly in the Views live preview area.

Another nice surprise in this title is that the author covers many other Drupal components besides Views. In chapter 2 Green dives right into Drupal theming showing us how to create template files for our Views and add PHP and CSS to tweak and manipulate our Views display output. So right here you're not just getting a book on using Views but also some basic instruction on how to build theme template files and add code to the tpl files.

In Chapter 3 Green moves into a detailed tutorial on creating a module. First he shows us the core Drupal Contact form (Contact module) and we build a simple contact form. Next he explains that we can extend this simple contact form by building a custom module to add custom fields to our form — for example adding fields to collect address information and also tweaking the labels for the core Contact form. Green explains in detail how to build a module and how to use Drupal's form_alter hook to "alter" our Contact form. It's the best description and explanation of the form_alter hook I've read. Again Green gives us much more here than simple Views building — he shows us how to build a module in Drupal. Finally bringing Views back into the discussion we learn how to glue all of the parts we have — the contact form, custom contact fields from our module, a CAPTCHA field, and an embedded Gmap using the embed_gmap module — into a View and then display this view on our site to show multiple Drupal components on one page. We end up building a dynamic Contact Us Web page that contains a map, contact information and a Contact form. Amazing stuff.

For the first 3 chapters alone I recommend this book to anyone just starting to use the Drupal Views module, any Drupal developer who is interested in theming Views, and any Drupal user who is just starting to build their own custom modules. The book covers so much terrain in the first 3 chapters it's a definite must have on anyone's Drupal bookshelf.

Chapters 4-8 of Green's Drupal 6 Attachment Views contains the brunt of discussion and tutorials on building Views to support various content output. These chapters will give developers a good amount of practice building Views since Green emphasized rebuilding a View for the practice vs. simply exporting and importing your View code. I agree with this method. It might be easier to export and import your code but you'll start to understand the inner workings of View arguments and relationships if you build them from scratch each time you need to configure one.

In chapter 4 Green shows us how to override View settings so your attachment View does not conflict with your page or block View. Green also points out here that we can configure Views for multiple audiences and target the View to specific roles such as anonymous users or logged in site admins. In this chapter we create a management role-based View for our admin users to access.

In chapter 5 Green shows us how to create complex Views using attachments to display Bio content of our company's employees. He returns to a discussion of theming showing us how to theme the output of our View, this time focusing on theming content to surround and display next to an image. View relationships are introduced in this chapter so that we can filter specific jobs to specific project managers who are in charge of the job — this is based on using a node reference field in our content type. Again a nice description and tutorial on how to use CCK fields in our View output.

I'll stress here that the entire book (but mostly in these Views intensive chapters) contains a nice balance of screenshots and descriptive text. The screens are important as it's always nice to have the visual aid to accompany the tutorial bullet points and instructional material. In chapter 6 we create another complex 3-view composite display similar to the one built in chapter 5. Again Green stresses practice makes perfect when it comes to using and building Views in Drupal.

Chapter 7 contains a interesting take on how to enhance and theme a simple "About Us" Web page. I liked the use of Views in this chapter to make a basic Drupal page more dynamic and interactive. Green's expertise is apparent in this chapter as he takes something so basic and static and turns it on its head (and takes it completely out of the box) to show you how you can engage static content better by building it using the Views module. This chapter is a gem in the book and one that clients should read — it will give clients ideas about how to take static content and make it vital content on their site. About Us pages do not need to be boring.

Chapter 8 focuses on building simple administrative control panel using Views. Again Green challenges us as Drupal developers to step out of the box and build useful and custom management tools for our clients.

Chapter 9 shows us how to build role specific menus outside of Views using the Drupal menu and block system. Green diversifies here and begins the excellent discussion in these last two chapters of Drupal's administrative functionality outside of the Views module which has up to this point been the focus of the book. Green gives a tutorial on how to create a "peek-a-boo" login block. What's that you ask? Read this chapter to get the full rundown — it's functionality that will impress your client — using Javascript and an API. Good stuff here. Finally a discussion of adding a new theme region to your Drupal theme (always good to know how to do) and a final look at the Views module, creating a current Jobs/News block.

Chapter 10 wraps this excellent title up by showing us some of Drupal's core functionality that always ends up on the "punch list" in our projects — stuff like:

* Setting the admin theme
* Enabling clean URLs
* Error reporting
* File system
* Input formats
* Logging
* Performance
* ... and more

Read Chapter 10 for sure and then show it to your lead admin/project manager on the client side since it's a great cheat sheet for administering Drupal.

Green had published an opus here on Drupal Views and Drupal 6.x in general. I'll enjoy working through this book in more detail and practicing his Views attachment problems in my own work.

You can purchase Drupal 6 Attachment Views from Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.


This discussion has been archived. No new comments can be posted.

Drupal 6 Attachment Views

Comments Filter:
  • more books (Score:4, Informative)

    by mr.dreadful ( 758768 ) on Monday May 24, 2010 @11:06AM (#32323632)
    "Green's book is without a doubt the definitive practical guide..." The Views module author has a book coming about views: []
  • Using Drupal did a good job of bringing a lot of it together for me.

    I only have limited experience with it and joomla (we'll say about your 300 hrs in each), but my feeling with Drupal is the opposite of yours.

    I feel that everything is connected ion a way that makes things awesome, where Joomla it was all over the place.

    I love how in Drupal everything is simply a node, so I can create products to sell, and using views make some decent categories, create a side-bar with top sellers, create an news feed of new products, etc.

    With CCK I can make content that is quite detailed, and using views I can display it however I want (on a map, in a hot list in the side bar, as blurbs in a blog kind-of style, a tagcloud of most popular keywords, an image slide show etc.).

    All of this is integrated quite well I think, and it allows for a module adding functionality to add it to everything, since in the end, it is all just nodes.

    I haven't used wordpress at all, but to contrast with Joomla, where when I install a map component, I am creating maps, not content.

    When i used a store module, I am creating products, not content.

    Yes there is a lot to drupal, but attachment views extend the functionality that does not exist in other systems, certainly not in a way that allows you to work with ALL of the content of a site in a consistent interface.

    though maybe I just drank the kool-aid...

I THINK MAN INVENTED THE CAR by instinct. -- Jack Handley, The New Mexican, 1988.