Using The Views Module in Drupal: An Example Application
The website www.alangillies.com has at its heart content which consists of news items stored within Drupal as blog items and opinion pieces stored as stories. The design called for the ability to produce bespoke pages providing separate access to the news items and opinion pieces, and to mirror those pages in RSS feeds.
To create a page of story items such as the opinion pieces at www.alangillies.com, the following steps are required:
1. Log onto the site as the “superuser" with full administrative rights.
2. Select “Administer"
3. From the Administer menu, select “Views" from the “Site Building"
4. Click on Add
5.At the next screen, a name and description are needed, and the type is set to “Node". This screen is now complete and Next takes the user to the screen where the query itself is constructed.
The default view to be created is a Page, so we can leave this as is and
6. Select the field to display
a. In 3rd column locate the Fields options. Click the + icon to add fields.
b. Scroll down to Defaults: Add fields. In the Groups drop-down menu select 'Node', then check the following field: Node: Node Title.
c. Then click Add.
d. The system will then offer you the chance to change the options associated with this field. For the Title field: Delete the 'Title' label. Select Link this field to its node.
e. Click Update.
7. Filtering to story nodes only
a. Click the + icon next to Filters.
b. In the Groups drop-down menu select 'Node', then check the Node: Published and Node: Type filters, and click Add.
c. Select the Published checkbox. Click Update
d. Select Is one of and check Story in the Node Type field. Click Update.
8. Sorting to show most recent first
a. Scroll up to Sort criteria and click the + icon.
b. 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.
c. Select Descending Sort order. Click Update.
9. Refining the basic settings
In the 1st column under Basic settings change the following options:
a. Items to Display setting, click on 10 and change the “10" to “6".
b. Click Update
c. At the Style setting, click on Unformatted and change to List.
d. Click Update.
10. Creating the bespoke page
a. In the dropdown on the left, ensure that Page is selected, and click Add Display.
b. Under Page settings, click the None link next to the Path setting.
c. Give the page a path so it can be managed with Drupal.
d. Click the None link next to the Menu setting, and attach the new page to the menu of your choice
11. Saving the view
a. Click Save to save your work.