Introduction to Views in Drupal

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

The Views module is the most downloaded contribution on drupal.org. It is a powerful list-maker that not only provides a GUI for creating a query but also gives you options on how you want to display your data. This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

For additional Views tutorials, including Drupal 8 Views lessons, see Display Content with Views.

Tutorials in this course
Categories
Drupal 7
More information

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

More information

In this video we'll take a tour of the Views user interface, starting with looking at existing views, editing one of them, seeing what we have to work with, and then making som edits. The Views interface has a lot of configuration options so it's good to have a sense of what is available and where things are located. We'll use many of the pieces throughout the series, but this video gets you started by making a few simple edits and then reviewing our changes.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

Categories
Drupal 7
More information

In this video we'll create our fist view from scratch. We make a Job Openings page, along with an associated RSS feed, and a sidebar block.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

Here we'll see how to customize what our View is showing by using the views formats. We look at a few different format styles and discuss the difference between using the fields or content settings for display.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

We'll look at making a nice, sortable table by switching from grid to table style, and using individual fields instead of teasers in the Job openings view we set up in the last video.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

Views relationships let you add related information to your view. Here is how you can take advantage of various references, like node and user references, or file information. We'll be using relationships to add some contact details to our Job openings view.

Additional notes:
If you don't see the field "fields" under the dropdown menu when creating a Relationship for the contact person's phone number it's possible you don't have the Views module enabled. (Or perhaps you've missed enabling the Views UI module...make sure you have both). Then complete the following steps:

  1. Create and SAVE your view-relationship.
  2. Create a user reference where you want to reference the user.
  3. Now when you create the user reference it will have an option to reference your view.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

In this video we look at what Views displays are, the different ones available out of the box, and how to add some block displays to our Job openings view.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

Views is great for making listings of all kinds of content for many different tasks and users. You don't always want everyone on your site to see everything you put in a view though. In this video we'll learn how to limit access to a particular view, using the built-in menu and access restriction settings. We create a new view to list all of the applications that have been received on the site and make sure that only site staff can access it.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

We've already used some filters in our views, but now we'll look at how to do a few fancy things with filters. We'll expose some filters to let our end users choose the filtering they would like to apply, and we'll see how you can decide whether all of the filters are required by using the AND and OR operators.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

Goes through the process of creating dynamic views with contextual filters by taking the content ID (i.e. the node it) from the URL and inserting that value as an argument for the views query. In the end, we're able to create a tab that shows all of the job applications for a particular job and have that view show up on the related job posting node.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

Goes through the process of attaching a views display to an existing view. In most cases this is done when the two views are closely related, but are displaying or highlighting different information. In this case, we'll set up a full teaser view of the latest job posting and display that at the top of the table, and we'll also create an offset on the original view so as to not show duplicate content on the attached view.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

Goes through the process of creating a view of something other than content. In this case it's a view of users, and this chapter talks about other types of views of entities that are possible from different base tables.

This video series will continue the Job Board example from the Fields for Site Builders series where we will discover ways to display all of the job postings, allow people to find the one they are looking for and easily apply for it.

More information

The Views Bulk Operations (VBO) module is a great extension for the Views module, which allows you to add bulk operation checkboxes and actions to any view. You often see bulk operations on various Drupal core administration pages, like the content administration screen, which lets you select multiple pieces of content, and then perform an action, like publishing or deleting, on all items at the same time. VBO lets you add this to your administrative screens, which allows you to create very customized reports that also have time-saving actions available to them as well.

Additional resources

This course appears in the following guides:
Categories
Site Building
Drupal 7, 8, 9, and 10