Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49214

Introduction to Views

$
0
0

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?


Viewing all articles
Browse latest Browse all 49214

Trending Articles