Follow Slashdot stories on Twitter


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:
  • by Viol8 ( 599362 ) on Monday May 24, 2010 @11:37AM (#32324042) Homepage

    "disappointed by the sprawling architecture and lack of cohesion of this product."

    Its written in PHP. What the hell do you expect? :o)

    Anyway , if you don't like it why do you use it?

  • Re:more books (Score:4, Insightful)

    by gorzek ( 647352 ) <gorzek AT gmail DOT com> on Monday May 24, 2010 @12:17PM (#32324602) Homepage Journal

    It's unfair to call it "charging for documentation." Views is quite well-documented. I figured out how to use it with no documentation whatsoever--it's pretty intuitive all on its own.

    I see nothing wrong with writing a popular open source program, then trying to make a little money writing books on how to use it effectively. There's nothing stopping others from writing up tutorials and giving those away for free. And, since the code is available, the author can't possibly keep any secret tricks to himself, to exploit only in the pages of a for-profit book.

    This might be a fair criticism for proprietary software, but it doesn't hold much water when it comes to open source, and especially not Drupal modules, which tend to be intuitive if not always well-documented.

  • Re:more books (Score:3, Insightful)

    by Sleepy ( 4551 ) on Monday May 24, 2010 @05:33PM (#32329102) Homepage

    >I'm somewhat against people writing open source software and then charging for the documentation.

    I could agree with your statement IF the following condition were TRUE: ... that third parties were prohibited from creating or sharing documentation.

    This isn't true, so I strongly feel your point of view is misplaced and not correct.

    It IS fair to say that Views is difficult for users who are not well familiar with databases. Views is a simple concept - get access to the raw data fields that make up content types - but in doing so you completely bypass all Drupal features put into place for usability reasons. For example, you can use Views to directly access User fields and Taxonomy, and build a list of all users and the Taxonomy tags they applied to content, and maybe which articles were the most frequently tagged. That's powerful. You could build a custom module to do this for you and you could make it with tons of user friendly and error checking features... but your application would be locked to "rails" or a fixed path.

    Views is a possibility engine.

    If I were you, I might moderate my opinion a little. If you are having trouble with Views, you CAN learn from Drupal camps or IRC or the Views forums. In doing so, try to be more PRECISE about your complaint -- remember, this is mostly a community of dedicated volunteers. When you praise something, you encourage more development. If you criticize something (AND you can't be bothered to get the complaint correct) then you will offend people and you will be ignored.

    It is very true that all the "smart people" working on Views are all done with Views 2, and hard at work on Views 3. A good number of them are working on Panels and Chaos Tools. Much of the Drupal Community is hard at work on Drupal 7. SO you have this situation here where there is plenty of accurate reference documentation by the projects - but not a lot in the way of deep tutorials. It's true that there isn't a lot of that kind of documentation, and if you are spoiled by Google (as I am) you can get frustrated that you can not simply Google for answers on some advanced topics.

    Put yourself in the place of the people you just criticized:
      What if you spent months volunteering for Habitat For Humanity or some other home-building group, and the first thing you hear from the beneficiary is them complaining: "I'm somewhat against people building housing for the poor, and then not providing handyman maintenance for free.". That person wouldn't DESERVE the house, and if this is how you would react then you deserve to stick with proprietary CMSs.

    (Never mind the much shorter counterpoint: Have you ever READ documentation for a proprietary CMS lately?It has been a long long time since documentation was bound and printed. It's all in a Help file now, which some users proudly state they will not read).

Did you hear that two rabbits escaped from the zoo and so far they have only recaptured 116 of them?