From HTML tables to Views

  • Posted on: 20 March 2010
  • By: David Thrale
Picture: 
Views screenshot

Before I discovered content management systems and Drupal, I had a list of birth, marriage and death records to which I added each time I went to the archive and looked up records.

Static HTML tables

In time I thought it would be an idea to share this, so I created a static HTML table, and all was well with the world. However, as I went to the archive the table grew bigger. I dealt with this initially by splitting the table over three pages, one each for births, marriages and deaths. This worked for a bit, but you guessed it, the data grew and each HTML page became too big. My next tactic was to break the pages into year ranges, but this was rather arbitrary and made navigation more difficult for users.

Drupal's Table Manager module

Then I discovered Drupal and the Table Manager module. For a while I was very impressed. This module keeps each record as a separate database entry and constructs each table on the fly. There are some options that allow the webmaster to make some changes to how the table is displayed. All was well with the world again. Alas, things didn't last. I found that changing table row headings wasn't possible, as I got error messages, or even worse the table got messed-up, and I had to restore the database to rectify this. There were other problems too, the records aren't found by Drupal's search facility, and the great mass search and replace module, could manipulate Table Manager data either. There were other frustrations too. The entry for each table cell was only a few characters, and could not include images. I soon became frustrated.

CCK & views

Then I discovered CCK and Views.

CCK

Allows webmasters to create custom fields in Drupal nodes. Thus, I was able to create fields for each cell in the table: District, Year, Quarter, Surname etc.

Views

Views is a very powerful module that allows users, to create reports that can be displayed in endless ways. I have created a single node type, into which all my birth, marriage and death data is input. I then use Views to extract three separate sets of data: births, marriages and deaths. The clever thing is that each view can display different fields, for example I do not want to display death age in the birth view.

Each view can also have 'exposed filters'. This enables users to filter the records, for example, to just display records from a date range, or a particular district or surname. Each individual record can have a link to display its data in a separate node, if you want you can also add images too.

It is even possible to bulk import data from Excel or CSV spreadsheets, using the Views Bonus Pack module. So if you are considering the question: Table Manager or CCK and Views?, I would advise CCK and views every time.