Iterative Drupal Development with the Minnesota Daily
Recently, the Minnesota Daily launched a new version of its Web site, mndaily.com. We launched our first version last year, and that was the first time we had used Drupal, a powerful open-source content management system (CMS). Although this new version is still built on Drupal, we have made significant improvements by taking much more advantage of Drupal’s powerful features.
Before we started using a CMS, we were using a custom framework that we built using PHP, HTML and other Web technologies. In 2008, we decided our site was overdue for a redesign. In the process of planning the redesign, we made the decision to move to a CMS. We chose Drupal because we had someone that had experience in Drupal and we thought that Drupal looked like it would be a powerful CMS that would do everything we needed. As it turns out, Drupal is a powerful CMS and it did everything that we needed.
What’s good about Drupal
I would have to say that one of the key advantages of Drupal is its vast collection of modules, extensions that you can download and install. They provide extra functionality/features and they range from a wide variety of services. For almost everything we wanted to do on the site, we were able to find a module for. There are also plenty of modules that provide integration with third-party services like Google Analytics, forum software, etc. On the rare occasion that we couldn’t find a module we were happy with, we were able to write our own module or slightly modify one that already existed. Drupal provides a framework for doing both.
The other key advantage of Drupal would have to be its theme layer. When I say theme layer, I don’t just mean the themes that you can download to change how your site looks; I mean the way in which the HTML gets rendered. How the theme layer works is before something gets rendered, it will go through some sort of preprocessing. Preprocessing allows you to control when, where and how something gets rendered. The preprocessing process (try saying that ten times fast) is generally used to process dynamic data and content. Once the preprocessing is done, it will pass all the data and content to templates.
Drupal follows a structure when trying to find templates. It will first look for specific templates (templates that was made for displaying a specific item) and will look for more general templates until it finds one. In this way, you can create specific templates for individual cases and use general templates for everything else. The theme layer is kind of hard to explain and it gets some getting used to. Note that you can set where and how it looks for templates during the preprocessing. This way you can tell Drupal to use a certain template without it needing to search for one.
How we use Drupal
I won’t go over every aspect of how we used Drupal in this post but I will mention some key functionality that we use.
ImageCache is a wonderful and powerful module that we use widely for this new version. ImageCache essentially lets you display photos in different sizes.
Before we started using ImageCache, we were using a module that created several different sizes (that we defined) of every photo we uploaded. There are several problems to this. For one, it only gave us the option of defining about five different sizes. This was a serious limitation as we found that we wanted a lot of different sizes depending on the page and the place. Second, every photo that we uploaded was recreated in all these different sizes. Most of the time, we only used one size and didn’t use the rest. This wasted a lot of disk space and processing power as we didn’t really need those extra sizes.
ImageCache provided a solution to all those problems. With ImageCache, we could define presets that defined the size and even the method at which the photo would get re-sized. So we could have a particular image scaled down if we wanted to keep its aspect ratio or we could have it get cropped and scaled when we wanted to re-size the image but force a particular aspect ratio. Every preset created another copy of the photo with the specifications defined. ImageCache lets you define as many presets as you want and you can choose from several methods to let you manipulate photos. To display a photo on a page, you tell the preprocessing where the image is and what preset you want to use.
The best thing about ImageCache is that the image only gets created if it’s being displayed for the first time, meaning that every photo size which exists is being used at least once. This way we can preserve disk space. ImageCache also lets you “flush” all the photos for a particular preset. This means that all the photos for that preset will be deleted. Why is deleting photos useful? For most news sites, there are plenty of old stories that probably never get read; most of these stories probably have photos. These photos are just taking up space and if they’re rarely going to be displayed, why keep them around? When an old story does get viewed, ImageCache will automatically recreate the photos for that story and store them. This is possible because the original photo is always preserved.
If you navigate around mndaily.com, you’ll find that there are a lot of photos that get displayed in a lot of different sizes. For example, an A&E story that appears on the front page in the A&E section also gets displayed on the A&E page. Both images that get displayed along with the story are different sizes and when you click on the story, there is the same photo in yet another size. All those photos are generated using ImageCache. When the time comes — say, three months later — we can flush the images but they will be recreated automatically if someone ever views the story again.
Theming the site
We heavily and extensively use templates and preprocessing for theming our site (as shown by the unique designs for the different sections). We didn’t really do anything different from what we did before except customize the templates a lot more. Drupal allows great flexibility in theming and lets you create templates for almost anything on the site. We just took further advantage of that to create custom designs for the different sections.
We also extensively use two modules: Views and Content Construction Kit (CCK). CCK is used to create the different kinds of content on the site. We don’t just have one generic form for creating everything. Rather, we use specific forms that can display specific fields which apply to the type of content we’re creating. For example, while articles have fields for the reporter and the story text, a slideshow has fields for the images. Having these custom forms and fields is all done by CCK.
Views lets you pick the content to display on the site. Almost all content on mndaily.com is displayed using Views. With Views, you can pick the type of content that you want to display and run it through any filters (like by sections) and sort it by date. Views and CCK are extremely powerful modules that are probably used by almost every Drupal site.
Drupal is definitely a powerful CMS. I haven’t personally used any other software such as WordPress or Joomla but I have read many comparisons. For the most part, many say that Drupal provides a lot of flexibility and customization but it it is very hard to use compared to other software. Both points are definitely true. We had some trouble getting used to Drupal when we launched our redesign in 2008. This resulted in an incomplete site with bugs and errors. After using Drupal for an entire year, however, we have learned a lot and were able to launch the second version of the site with much success. Drupal definitely has a huge learning curve but once you know and understand Drupal, you have the ability to do a lot of cool things in a shorter time span.
For more information about the Minnesota Daily’s improved Web site, view this blog post on mndaily.com.