Site Building

Overview of Views for Drupal 7

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Sprout Video

Back in the olden days of Drupal, we used to write raw SQL. Now, Views does all of this for us. Views allows you to create a list of only the content that you want, based on criteria that you define.

In this video we demonstrate the first things to do when creating a View: selecting our Base Table, specifying the Display, looking at Advanced Features to filter content, and specifying the HTML output.

Throughout the course of this series, we're going to start with the content types and fields that we created during the Intro to Fields for Site Builders video series. We'll continue the job board example, and create unique listings.

Our apologies! The audio on this video is really bad and hard to listen to because of some background hissing. On top of that, the transcript interface using the "T" icon is broken on this video. Double-boo! Here is the text of the audio. Note: You can also mute the audio and display the captions by clicking the "cc" icon on the lower right corner of the video player.

Views is the most popular contributed module. In the subsequent chapters, we'll show you step-by-step how to use Views.

Views is a query builder that makes lists of your content. But what does that mean? Let's pretend we're looking for a new car. And we want our salesperson to only show us green cars. No, let's make that blue cars. Or maybe, we only want to see trucks.

Think of all of your content as this giant parking lot. Views allows you to create a list of only the content that you want, based on the criteria that you define. And you can concatenate this criteria. You can say, show me all the content that is of the type, article and, authored by the admin user.

Back in the olden days of Drupal, we used to write raw SQL. Now, Views does all of this for us. To create a list of content on our site, we don't need to know anything about the database at all. Views will give us an administrative interface where we can click around to configure our criteria, and also how we'd like it to be output. The previous slide showed us that there are a lot of options to select from. But in basic terms-- Views sucks data in, fires off magic thingies, and then outputs hotness.

When creating a View, the first thing that we select is our Base Table. This is the pool of data from where we want to start creating our lists. Do we want to show information about nodes, or users, or comments, even. And then we can select what we'd like our first Display to be. Should our list to be a page, with a unique URL. Or a block, that we can place in any region in our site. For a Display, in addition to selecting the filter criteria, we can specify which fields we want to appear. And also, what order we'd like our content listed. Advanced Features allows us to filter content based on a current condition-- like the URL, or the logged-in user.

We also can gather information that is related to our current result. Views allows us to have multiple displays for each View. For each subsequent Display you create, it will inherit the configurations of your first Display. Although the new Display utilizes your previous settings, you can override that. Once we've selected our Base Table, and configured our Display settings, Views will also allow us to specify the HTML output. We can choose from a simple div structure, and ordered lists, or even a table.

Views is a powerful and highly-configurable list maker. Throughout the course of these videos, we're going to take the content types and fields that we created during the Intro to Fields for Site Builders video series. We'll continue the job board example, and create unique listings. The Views module contains so many configurations and settings. Through our practical examples, we aim to demystify it. So let's dive in.

Additional resources

Views module at Drupal.org