Introduction to Views

Events happening in the community are now at Drupal community events on www.drupal.org.
scottrouse's picture

Here are some (hopefully helpful) notes from the Introduction to Views meeting. I've tried to cover some of the basic points from my presentation here for your convenience. Please feel free to continue the discussion below. I always prefer to answer questions about troubles you may run into on these public forums with the hope that it will help others learn.

What is Views?

Views is a contributed Drupal module which allows you to craft different displays of content on your site. It essentially is a GUI interface for writing complicated queries of your Drupal database.

Andy put it very well tonight. He said that you can think of almost all content on any website as either a single piece of content or a list of content. Views helps you construct those lists. Of course, like most things Drupal, it can go far beyond that...even helping you construct what a single piece of content looks like.

Getting Views

Views is available online at http://drupal.org/project/views. Remember, if you're downloading contributed modules, you need to put them in the correct directory. For a standard, single-site installation, they go in the /sites/all/modules directory (not the /modules directory).

I prefer the Drush method:

drush dl views

Enabling Views

You must enable both the Views and Views UI modules from the Modules list (admin/build/modules) in order to work with your Views. Views UI can be disabled after Views are built and configured, if you desire. I don't desire.

Drush:

drush en views views_ui

Working with Views

The Views admin UI is available at admin/build/views. Your first step is to add a new View. Give that View a name (machine-readable) and a description (optional) and choose the primary type of content to be used in that View. If you're not sure what to pick, the answer is probably Node.

You'll then enter the View Edit interface. There are lots of buttons to push here, but here's my run-down for a simple View:

  1. What type of content are you trying to display? Use the Filters to filter by Node type and Published status.
  2. Are you displaying entire nodes (Teaser or Full version) or just certain fields from content type(s)? Set that in your Row style under the Basic settings box.
  3. If you chose Fields, choose which Fields in the Fields box.
  4. Choose the Display style. HTML list, table, grid, etc.
  5. Experiment with the other Basic settings for the desired effect. i.e. - number of items, pager or no pager, text/html above or below the View, what to display if the View is empty, etc.
  6. Choose your Sort criteria.
  7. Now, add the Display type(s) you want. To start with, try a Block and/or a Page.
  8. Save your View and bask in all its glory.

Expanding Views

There are many ways in which you can enhance the power of Views.

Display Types

The default display types for Views include:

  • Attachment
  • Block
  • Feed
  • Page

Contributed modules can add other helpful display types including:

Display Styles

The default display styles for Views include:

  • Grid
  • HTML List
  • Table
  • Unformatted

Contributed modules can add other helpful display types including:

Visit http://drupal.org/taxonomy/term/89 to see other modules affiliated with Views.

Views Intergration

Many other contributed modules offer out-of-the box Views integration (or Views has been built to integrate with those modules).

What's your story?

So, tell us how you've used Views in interesting ways on your site. Here are some Views I've made. Can you figure out how?

Comments

Video shot, will get up eventually

laken's picture

Scott, thanks so much for this class, and this post is a helpful guide for people to get started. I'd add that the excellent Using Drupal book has in-depth coverage of how to use Views.

Also thanks to Christopher Cable who shot video of today's class. I'm having some technical challenges getting the video files into an editable format, but hope to overcome them soon and get the video posted to our Vimeo group for the benefit of those who couldn't attend or who came late.

Video editing

opegasus's picture

Many thanks to Scott for a wonderful class on Views!

Andy your chime in's are terrific as they add some special understanding that helps by providing additional perspective.

I will be all to happy to edit the video and drive a copy North for upload. I have the software to accomplish
this, alas it means a delay of a couple of days so if all will be patient? ;-D

Video Available

scottrouse's picture

The Introduction to Views video is now available on the Western Montana Drupal Group on Vimeo.

A huge thanks to Christopher for his work on shooting and processing this video for us!

I'm a bit blurry in the video but, honestly, when am I not!?! :-)

-Scott

A question regarding views

elvin - albania drupal developer's picture

Hello everyone

I am trying to set up a listing with veiws and have succeded. But i want to allow the users to chosse between the layout the view results are rendered (as rows or as a gallery)

an example can be found here
http://www.immobilien.de/suche/ergebnis.html?h=9e61b7af5f9d6cf456d07b860...

If anoyone has an idea please email me at: exhimitiku@gmail.com

Cheers

Elvin Xhimitiku
Drupal In Albania

I was just testing old features

Diseño web Mallorca's picture

Does anyone know how to still use this Drupa 7 module and core? I think Drupal 8 i getting a little slow.


Diseño web Mallorca

Western Montana

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week