Views

Published March 27, 2009
You have all this content, you need to list it, sort it, filter it, form relationships, make it look pretty. We consider Views a must-have!

Views is a universal API to let any user or module make a list of just about anything on your Drupal site: views comes with the ability to list all of Drupal's "first class objects":

Nodes
most views list nodes, and nodes have the most power and felxibility in a Drupal site
Aggregator Items
list stories in an RSS feed, sort them, filter them
Comments
maybe list all comments in moderation, or comments from users with the Editor role
Files
think: all files by one user, all MP3 files
Node revisions
Peek into the history of your content
Taxonomy Terms
Create custom navigation fast
Users
Combined with something like Userpoints, a list of folks who are active on your site
Access Log entries
find out where users are hitting your site, how they got there, and when

Stats

So, you want to build a content management system? They're all the same, aren't they? Admin screens, RSS feeds, Calendar, Contact form, the list goes on...

On the other hand, that makes me think of one area no framework agrees on... Lists! Drupal doesn't even have a built-in way of displaying a list of all nodes of type "X" to users.

There are all kinds of things you could list: nodes, users, comments, files, and the like. Sure, you could write custom SQL queries, but what if you'd like to give your site administrators and users an interface to filter and sort your list?

Doesn't Drupal want to help you list your content, with pretty checkboxes, select lists and text fields? And what about your Permissions? You spent some time deciding who was allowed to see everything, shouldn't there be an easier way to make these lists and hide those things with special needs?

You shouldn't have to write custom code to get a list of your stuff, display it in a block, or even to get an RSS feed of that list. This is why we have the Views module.

How deep does views go? Well, if you're using a nodereference field, you can have the list of possible selections populated by a view! Don't even get me started on Views Arguments; in short, it turns one view into several views, by allowing you to pass in data through the URL. Your list of all blogs by one user has now turned into a list of blogs by user "X", on date "Y", in category "Z".

And you never wrote a lick of code. Once you start writing code for views, it gets even more powerful.