What Are Drupal 'Views'?

Drupal logo


The Drupal Views module allows you to organize and show your content to the world in almost any way you can think of. Over half a million Drupal sites report that they use the Views module.

For instance, let's say you have a custom content type for book reviews. Each book review includes the following fields:

  • Cover image
  • Title
  • Author
  • Publisher
  • Publication year

By default, Drupal will let you make a basic listing of these reviews. You can hide or show each field in the listing, and set the size of the cover image and not a whole lot else.

Mix and Match Your Content

With Views, on the other hand, you can mix and match this data into all kinds of custom listings. For instance, you could:

  • Have a page that lists all books by only their title. Each title links to the full review.
  • Have another page that lists all the authors you've reviewed. Each author links to a short listing of titles by that author.
  • Have a third page that is only cover images, in a grid. Each image links to the full review.
  • Have a sidebar that shows only the thumbnail cover image and teaser for your six most recent reviews. Further, you only show those books which are tagged with the terms "western", "mystery", or "readable Star Trek fan fiction".

Look, Ma! No Code!

You can build all these views without a single line of code.

If you had to do a view in code, it would look something like this:

SELECT node.nid AS nid,
node.created AS node_created
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
WHERE (node.status = 1 OR (node.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1) AND (node.promote <> 0) AND (UPPER(term_data.name) = UPPER('blog'))
ORDER BY node_created DESC

And that's just the MySQL query.

Thinking in Content Types and Views

As you learn to work with custom content types and views, you'll discover that they can solve a huge percentage of hitherto intractable CMS problems.

So often, you or your client will want "special" pages that, on other CMS software, would require complex coding, or a desperate hunt for a plugin. With a little thought, you can reduce them to one or more custom content types, and a well-built view.

Extend Views With Custom Modules

True, views can't do everything, but if you ever find yourself up against the limits of Views, check:


There are thousands of models that extend Views. As always, you should choose modules wisely, but it's quite possible that someone's already solved your problem.

Learn Views First

Before you go looking for a custom module, make sure you've learned what "basic" Views can do. There are plenty of tutorials out there, but the best way to learn is to enable one of the included views.