Theory: everything in your drupal site is actually stored in the underlying database.
Views allows you to query and extract certain portions of that database (without having to worry so much about the syntax)...
MOST importantly, not only can you get the results of your search, but you can Display the results in different formats (e.g. different "displays")...
First, download, extract, and then upload the views module http://drupal.org/project/views
Administer -> Site Building -> Modules and enable (checkbox) the View Module
Administer -> Site Building -> Views
View type: (primary table for information being retrieved)
*Node = the default content type of drupal File = underlying files in the system
Direct from the Drupal Views Module -> Advanced Help Module
Amazingly these instructions appear to work, rather than re-invent the wheel I have decided to redistribute the wheel.
NOTE there's a graphical configuration (with live preview)...
But sometimes when you click an option you are almost invisibly given a new section below to fill out and then you have to Save or Add or Update it ... a little weird.
(When you click on an option a textbox opens below... fill it and click UPDATE! or ADD!)
Create a block of recent stories
In this example you will create a list of nodes of the content type "story", to be shown in a block. Through this step-by-step process, you will become familiar with some basic steps in creating a view, and familiarize yourself with the Views User Interface.
Creating a new view
Go to "add new view". Give your new view the name 'recent_stories', description 'Recent Stories', tag 'story', type 'Node' and click Next.
DEFAULT = About the interface (default options for this view)
You have been brought to Views User Interface. You start by editing the "Default" options for the view (which every "display" for this view will inherit).
In the 1st column on the left you can see the drop-down menu offers 'block', for example, to select settings specific only to block views. In the remaining columns, you will be able to add or change options by clicking on links or icons.
These options will then appear below this main area, often you will need to scroll down.
FIELD Selecting the fields to display
FIELDS (+) you must choose which thing(s) you wish to display e.g. Content: photo (field_photo) or Node: Title or Node: Teaser, or date etc.
1. In 3rd column locate the Fields options. Click the + icon to add fields. 2. Scroll down to Defaults: Add fields. In the Groups drop-down menu select
'Node', then check the following two fields: Node: Post date, Node: Title. Then click Add. 3. You will be taken through the fields you added one at a time. Make the chan ges specified below. * For the Post date field: Delete the 'Post date' label. Change the Date format to Custom, and the Custom date format to 'F j, Y, g:i a' (do not type the single quotes; for the meaning of these letter codes, click on the PHP docs link under that box to arrive at the explanation). Click Update. * For the Title field: Delete the 'Title' label. Select Link this field to its node. Click Update. 4. Scroll back up to Fields and click the ?? icon to rearrange fields. 5. Drag the four-sided arrow next to Node: Title so that it appears above Node:Post date. Click Update to save the new field order.
FILTER Filtering to show nodes that are of type story only (and published!)
1. Click the + icon next to Filters. 2. In the Groups drop-down menu select 'Node', then check the Node: Published
and Node: Type filters, and click Add. 3. Select the Published checkbox. Click Update 4. Select Is one of and check Story in the Node Type field. Click Update.
SORT Sorting to show most recent first 1. Scroll up to Sort criteria and click the + icon. 2. In the Groups drop-down menu below, select 'Node', then check Node: Post date, and click Add. Alternatively, you may instead check Node: Last comment time, or Node: Updated/commented date, or Node: Updated date. 3. Select Descending Sort order. Click Update.
Refining the basic settings * In 1st column under Basic settings locate these options: Items to Display setting, click 10. Change the '10' to '4'. Click Update Style setting, click Unformatted. Change to List. Click Update.
Adding a block display for custom options
- In the dropdown on the left, ensure that Block is selected, and click Add Display.
- Under Block settings, click the None link next to the Admin setting. Change Block: Block admin description to 'Recent Stories'.
Saving the view = Click Save to save your work.
Instructing Drupal to show the block
Finally, you should tell Drupal to show this block. Configure your block by going to admin/build/block. Locate the block in the list: it is labeled Recent Stories. Place this block in a region and click Save. You may click Configure to set a different title , to determine which roles can view the block, and on which pages it appears; If you want your block on the front page only, enter '