This tutorial is designed to do two things:

  1. Show you how to sort Drupal nodes alphabetically
  2. Introduce you to the Views module

Views is, without question, the most important Drupal module that is not in the core. It allows you to use a graphical interface to sort and organize all your nodes. It a powerful but also complex module and it can take a lot of time to learn all its features. This tutorial will only help you get your feet wet.

This particular tutorial was inspired by a site member who had the contact details of many employees stored as nodes. They wanted to make an alphabetical directory of all the staff members.

 

Install Views

tutuploadsmedia_1290010356863.png

Download and install the Views module from the Drupal site: http://drupal.org/project/views

I'm also going to use the Devel module for this: http://drupal.org/project/devel. That has a "Generate Items" option that will allow me to create lots of dummy content to test my alphabetical directory.

Access Views

tutuploadsmedia_1290010719941.png

To access the Views module, go to Administer >> Site building >> Views

tutuploadsmedia_1290010801485.png

On the first Views screen you'll see a list of sample views waiting to be activated. These include:

  • Archive: "Display a list of months that link to content for that month. "
  • Recent Comments: "Contains a block and a page to list recent comments"
  • Glossary: "A list of all content, by letter. "

Not surprisingly, Glossary is the one we want so click "Enable" next to it.

tutuploadsmedia_1290010861118.png

In order to see what this view will look like, click on the word "glosssary" next to Path:

tutuploadsmedia_1290010910397.png

You'll see an alphabetical directory of nodes, listed according to their first letter:

tutuploadsmedia_1290010956201.png

Editing the View

tutuploadsmedia_1290010990439.png

In order to adapt this view to our needs, we'll need to change some aspects of it. To do that, hit the back button in your browser and click on "Edit" next to the glossary entry. You'll be taken to the main editing page for the Views module. This is where you can make any and all changes to your view:

tutuploadsmedia_1290011049567.png

Modifying the View's Fields

tutuploadsmedia_1290011064292.png

We're not going to explain all aspects of the views module in this short tutorial, but we will dive into some aspects of how it works.

For example, you will have noticed the view had three items from each node: the Title, the Author and the date of the Last update. For a directory of staff members, we don't need those last two items, or as Drupal refers to them "fields".

Here's how to remove them:

tutuploadsmedia_1290011089966.png

Click on "User: Name Author"

tutuploadsmedia_1290011127688.png

Scroll all the way to the bottom of the page and click "Remove".

The repeat the process for "Node: Last Updated" and when you're done the Fields area should look like the screenshot below:

tutuploadsmedia_1290012946892.png

Filtering Out the Nodes in the View

tutuploadsmedia_1290012971811.png

One other step we'll need to take is filtering our nodes so that only the Contact nodes are shown in the view. It won't be a very good directory of staff members if pages, stories and other node types are included. We can do that via the "Filters" area. To get started, click on the plus sign.

tutuploadsmedia_1290011886559.png

You can filter by many different methods, but we're going to choose the filter by Node type.

Use the dropdown menu to choose "Node" and quickly get to all the node-related filters. Then check "Node: Type" and click "Add".

tutuploadsmedia_1290011945365.png

On the next screen, choose the nodes you'd like to appear on this view and then click "Update default display". The final result should look like the screen below.

tutuploadsmedia_1290013635830.png

Now that you've made those changes, finish off by clicking "Save" at the bottom of the page.

tutuploadsmedia_1290012040236.png

That should be the final step

The End Result

tutuploadsmedia_1290012087522.png

This will be the end result of your work. All of your Contact nodes will be sorted in an alphabetical directory.

Hopefully it has also been a introduction to the Views module, one you'll be using much more as you progress with Drupal.

Login to post comments

advertise with us

Boost your traffic and expand your pool of potential customers

8000 active members

Ready to join Now?

CMS Portal - The free marketplace for submitting Joomla, Drupal, Wordpress, Magento, phpBB, Prestashop, vBulletin, Opencart Templates and more.

FOLLOW US

Email Newsletters

Make sure you don't miss interesting happenings by joining our newsletter program.
konya escort eskisehir escort canakkale escort samsun escort balikesir escort aydin escort hatay escort kahramanmaras escort giresun escort tokat escort
Joomla Templates Free Joomla Templates Virtuemart Templates K2 Templates JoomShopping Templates HikaShop Templates SobiPro Templates OpenCart Themes
Magento Themes Magento Extensions Free Magento Extensions Prestashop Themes Prestashop Modules Magento 2 Themes
bettilt
tempobet