Getting familiar with Drupal themes

Getting familiar with Drupal themes

WordPress is a very popular content management system (CMS). It is now estimated that 17% of the websites online use WordPress. I am personally really passionate about WordPress theme development, so my CMS of choice would be WordPress. However, WordPress is not the only option when it comes to CMS. Some of the other major CMSs are Joomla and Drupal. Today, I will be focusing on Drupal.

Theme parts

In Drupal, content is displayed through different theme parts such as nodes, comments, and blocks. Nodes are essentially the content on Drupal sites. Nodes include things like pages and blog entries.

Blocks are boxes that contain different content. It kind of acts like a dynamic sidebar in WordPress. The content and visibility for each block could be set up in the administrator area.

The .info file

There are some files that are an important part of Drupal themes.

The first file is the .info file. Every Drupal theme has one, and it looks something like this:

name = Garland
description = Tableless, recolorable, multi-column, fluid width theme (default).
version = VERSION
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css
stylesheets[print][] = print.css

It contains all the information needed for configuring a Drupal theme, such as the theme name and all the stylesheet files. The .info file also contains JavaScript files that are included in the theme in addition to stylesheets. Just as in WordPress, the main stylesheet is usually called style.css.

The template files

In addition to the standard stylesheets and JavaScript files, Drupal uses PHP template files to customize Drupal themes. The template files have the file extention .tpl.php. Some of the common template files that you will find in a Drupal theme are:

  • node.tpl.php
  • comment.tpl.php
  • block.tpl.php
  • page.tpl.php

Just as how there are different template parts in WordPress, each Drupal template file controls the parts of a Drupal theme. For example, node.tpl.php would control how nodes are displayed when using a Drupal theme. I think the most important and useful template file is page.tpl.php. This file controls the structure of the whole page. It is basically a document with all the HTML in it with Drupal variables plugged in.

Conclusion

The biggest allure to using Drupal is that it is highly customizable. There are many things you could do in Drupal by using things called modules, which involve lots of PHP. One of the disadvantages is that it could be hard to get familiar with it because of the complex user interface and all the customizations that are possible. However, Drupal has a great community of developers and documentation available just like WordPress. This article just skims the surface, but I hope this article was helpful in your understanding of Drupal themes.

By: Blueprint