Posts about Drupal, the open source content management system.

Drupal Logo

Drupal 6 Views Templates

22nd March 2011 - 14 minutes read time

Rewriting the output of a Drupal view isn't always necessary, but figuring out what to do with the available templates can very useful. It is, however, also a bit of a stumbling block from time to time, especially for newcommers. After you have created your view you will have a number of filters to restrict your data, and a set of fields which are printed by Views using a set of templates. How these templates are used depends on what sort of view data you use and style you select, but there will be three standard templates that are always used in views. These templates are display, style and row and can be treated like any other Drupal template in that you can override them with more specific filenames.

Drupal Logo

Drupal 6: List Selection Zero Value Fix

7th March 2011 - 3 minutes read time

I discovered a little issue recently with the Profile module in Drupal 6 and after finding the solution I thought I would post it here in case it helps anyone else.

The problem occurs when using the list selection form item in a specific way. This form item works find for just about every situation, except one special case. Lets assume that you wanted to ask a user a question which requires a number between zero and four; you enter the following into the selection options box.


This is saved fine, but when the form is rendered it doesn't actually print out the option to select 0, which is odd as the value is definitely saved in the database and can be reedited in the form admin.

Drupal Logo

Drupal Features

14th February 2011 - 8 minutes read time

The Drupal Features module is a way of packaging site components with the ultimate aim of easing migration. For example, an events section in Drupal doesn't just contain a node type called events, it also contains all of the configuration settings around comments, fields added to the node type, permissions available to users, menu items created and any views used to aggregate or search the events. Features can integrate module dependencies so that all functionality that has been packaged along with the feature is available on the other system.

The main thing to realize about Features is that they are not meant to transport content, just blocks of functionality. The idea is that if you create a "blog" feature then you can package that and deploy it to multiple sites.

Drupal Logo

Filtering Node Types In Drupal 6 Search

31st January 2011 - 7 minutes read time

A common practice when creating sites in Drupal is to create different node types for different purposes. Sometimes these node types can be functionality based rather than content based and are used for creating a rotating banner or something similar. A side effect of this is that you will then see these nodes appearing in search results, which can cause some confusing results to be displayed.

So how do you remove these nodes? Well with quite a simple little module you can intercept the search query and stop certain node types being searched for. Adding a couple of extra functions means that we can add form controls to the advanced search form and the search admin area so that nodes can be selected to be excluded from the search results.

Drupal Logo

5 New Things In Drupal 7

20th January 2011 - 6 minutes read time

A couple of weeks ago saw the release of Drupal 7 so I thought I would run through a few new features that might be of interest. This certainly isn't a comprehensive list of new things as there is a lot of changes in this new version.

1 - Admin Interface
Drupal 7 comes with a nice new admin interface that has gone through lots of usability testing and redesign which has resulted in two new themes being bundled with the system. The admin interface is powered by a brand new bundled theme called Seven, the new front end theme is called Bartik. The old Garland theme is still there, but isn't enabled, so you can still use if you feel the need. Some of the older table based themes have now gone in favour of these new themes. The new Overlay module makes it easier to administer Drupal by displaying the admin pages as a layer over the current page, rather than moving the user around the site.

Drupal Logo

Drupal Private File Downloads With Public Files Access Set

16th August 2010 - 3 minutes read time

Drupal has two ways in which to allow users to download files, these are private and public.

With public the files are open for anyone to download and Drupal is not involved in the download process. This means that no statistics are recorded or permissions used when downloading the file. Each file is referenced by name.

Private file access means that Drupal is run every time a file is downloaded. This allows the download to be recorded and a permissions check run to make sure that the user in question is allowed to access the file. Each file is referenced by a path that can be completely different from the original filename.

Drupal Logo

Drupal hook_form_alter() On Node Form

19th July 2010 - 2 minutes read time

I just spend the last few minutes looking for the solution to this so I thought that someone else might be able to benefit from it.

Calling the hook_form_alter() hook in your module using just the module name allows you to target all forms in your system, if that's the sort of thing you want to do. For a module called "My Module" this would be called mymodule_form_alter().

The power of hook_form_alter() hook is that it alos allows you to specifically target a form with a specific name within a module. A good example is if you want to alter the search form to add a class, which is a common task. To do this, create a module so that you can add the hook_form_alter() hook to it and then construct the function name in the following way:

Drupal Logo

Drupal Focus On Enterprise, London, 26 May 2010

31st May 2010 - 15 minutes read time
Drupal Focus On Enterprise 2010

2010 saw the third annual Drupal Focus on Enterprise conference, which took place at the Sun Microsystems offices in London. The free event, which is sponsored by Sun, brought together a set of speakers to talk about different things that they or their businesses have done with Drupal. Even though I live in Manchester I was lucky enough to go along.

The conference consisted of two tracks, with a number of talks in each. I obviously couldn't go to every talk, but the talks I did see were of a very professional standard. The tracks weren't set in designated rooms but a head count was made of everyone who wanted to see which track and the bigger room used for the talk that got more votes.

I also arranged to meet fellow North West Drupal User Group (NWDUG) member @eli_t at the conference.

Drupal Logo

Related Items Block Using Drupal 6 Search

23rd May 2010 - 10 minutes read time

A related items block looks at the current content of the page and tries to present the user with a list of items that relate to the current content. Creating a related items block is quite easy, and is a good way of introducing the search module api without having to get to involved in the search module.

Before starting I should point out that there are other related items modules available. These are modules like Related Nodes or Related Items but these modules either aren't released for Drupal 6, or simply don't work in the way I wanted the block to work. I wanted a module that would act with little or no user input.