Your message has been sent.
This article has been saved to your account.
Go to my account
This article has been emailed to your Kindle.
Send this article
You can find both design ideas and complete themes on the Web. You need to decide whether you want to work with an existing theme, or convert a design into a theme, or whether you want to start from scratch, unburdened by any preliminary constraints or alien code.
This article by Ric Shreves assumes you have a working Drupal installation, and that you have access to the files on your server and deals with finding, installing, and then uninstalling an existing and current Drupal theme.
The large and active community of developers that has formed around Drupal guarantees a steady flow of themes for this popular CMS. The diversity of that community also assures that there will be a wide variety of themes produced. Add into the equation the existence of a growing number of commercial and open source web designs and you can be certain that somewhere out there is a design that is close to what you want. The issue becomes identifying the sources of themes and designs, and determining how much work you want to do yourself.
You can find both design ideas and complete themes on the Web. You need to decide whether you want to work with an existing theme, or convert a design into a theme, or whether you want to start from scratch, unburdened by any preliminary constraints or alien code. For purposes of this article, we will be dealing with finding, installing, and then uninstalling an existing and current Drupal theme.
This article assumes you have a working Drupal installation, and that you have access to the files on your server.
Finding Additional Themes
There are several factors to consider when determining the suitability of an existing theme.
The first issue is compatibility. Due to changes made to Drupal in the 5.x series, older themes will not work properly with Drupal 5.x. Accordingly, your first step is to determine which version of Drupal you are running.
To find the version information for your installation, go to Administer | Logs | Status Report. The first line of the Status Report tabular data will show your version number.
If you do not see the Status Report option, then you are probably using a Drupal version earlier than 5.x. We suggest you upgrade as this book is for Drupal 5.x.
If you know your Drupal version, you can confirm whether the theme you are considering is usable on your system. If the theme you are looking at doesn't provide versioning information, assume the worst and make sure you back up your site before you install the questionable theme.
Once you're past the compatibility hurdle, your next concern is system requirements; does the theme require any additional extensions to work properly?
Some themes are ready to run with no additional extensions required. Many themes require that your Drupal installation include a particular templating engine. The most commonly required templating engine is PHPTemplate. If you are running a recent instance of Drupal, you will find that the PHPTemplate engine is installed by default. You can also download a variety of other popular templating engines, including Smarty and PHPTal from http://drupal.org/project/Theme+engines.Check carefully whether the theme you've chosen requires you to download and install other extensions. If so, track down the additional extensions and install them first, before you install your theme.
A good place to start looking for a complete Drupal theme is, perhaps not surprisingly, the official Drupal site. At Drupal.org, you can find a variety of downloads, including both themes and template engines. Go to http://drupal.org/project/Themes to find a listing of the current collection of themes. All the themes state very clearly the version compatibility and whether there are any prerequisites to run the theme.
In addition to the resources on the official Drupal site, there is an assortment of fan sites providing themes. Some sites are open source, others commercial, and a fair number are running unusual licenses (most frequently asking that footers be left intact with links back to their sites). Some of the themes available are great; most are average. If your firm is brand sensitive, or your design idiosyncratic, you will probably find yourself working from scratch.
Regardless of your particular needs, the theme repositories are a good place to start gathering ideas. Even if you cannot find exactly what you need, you sometimes find something with which you can work. An existing set of properly formed theme files can jump start your efforts and save you a ton of time.
If you wish to use an existing theme, pay attention to the terms of usage. You can save yourself (or your clients) major headaches by catching any unusual licensing provisions early in the process. There's nothing worse than spending hours on a theme only to discover its use is somehow restricted.
One source for designs with livable usage policies is the Open Source Web Design site, http://www.oswd.org, which includes a repository of designs, all governed by open source licensing terms. The down side of this resource is that all you get is the design—not the code, not a ready-made theme. You will need to convert the design into a usable theme.
For this article, let's search out a completed theme and for the sake of simplicity, let's take one from the official Drupal site. I am going to download the Gagarin theme from Drupal.org. I'll refer to this theme as a working example of some ofthe steps below. You can either grab a copy of the same theme or you can use another—the principles are the same regardless.
Gagarin is an elegant little theme from Garamond of the Russian Drupal community. Gagarin is set up for a two-column site (though it can be run in three columns) and works particularly well for a blog site.
eBook Price: $23.99
Book Price: $39.99
Installing an Additional Theme
Theme installation requires that you have the ability to move files from your local machine on to your server. Typically, this is done with an FTP client or through your hosting control panel file manager. The method you use is up to you, both have their advantages. It makes no difference to Drupal which method you choose to employ.
Odds are your theme was delivered to you as a single file containing a compressed archive of files. When I downloaded Gagarin, above, I wound up with the file gagarin-5.x-1.x-dev.tar.gz. The .tar.gz format (a.k.a. "tarball") is one of several commonly used to create compressed archives.
The first step towards getting the theme installed is to locally uncompress the archive. Double click the tarball and one of two things will happen: Either the file will uncompress and leave you with a new folder name "gagarin" or your system will prompt you to look for an application to open this file type. In the latter case, you will need to track down and install a file compression program. There are lots of good ones out there. Most users, however, should have no problems as compression software is installed on many systems these days.
Once you have successfully extracted the files, take a look at what you have. If there is a README file, read it now.
The next step is to get the extracted files up to your server. Use whatever means you prefer (FTP, control panel, etc.) to gain access to the directories of your Drupal siteon the server.
Once you have access to your sever, navigate to the directory sites/all; this is where you will place all new theme files.
A note for old Drupal hands: The use of the sites/all directory is a change that was implemented in the version 5.x family. Using the sites/all directory instead of the traditional themes directory, allows you to run multiple sites off a single Drupal installation. Placing all your extensions inside the sites/all directory means less complication with future upgrades.
Next, in the sites/all directory, create a new sub-directory and name it themes. This new themes directory is where you will place all additional theme files. Finally, copy thegagarin directory and its contents inside sites/all/themes. Each theme should be kept in a separate directory. In this case you should have wound up with a directory structure like this: sites/all/themes/gagarin.
If all has gone according to plan, you are now ready to close your connection to your server and visit the admin interface of your Drupal site.
For the next steps, access the admin interface to your site via your browser. Navigate to Administer|Site building|Themes. You should see your new theme listed alphabetically in the list of themes, as per the illustration, below.
The theme management screen presents you with a list of all the themes available on your site. Note the Enabled checkbox and the Default radio button; these controls are key to making a theme display on the site.
To set up Gagarin, first we must enable it, then assign it to appear where we want, then configure it.
To enable Gagarin, select the Enabled checkbox to the right of the theme name. In Drupal, you must enable each theme you wish to use on the site.
Once you've selected Enable, then click the Save Configuration button at the bottom of the screen. Note that the appearance of the site does not change—that is because the new theme is neither assigned to any pages (nodes) nor is it set as the default.
Next, let's assign the theme to appear where we want. In this case, I want Gagarin to appear throughout the site, so I am going to select the Default radio button. The Default control is important; it sets the primary theme—the default theme—for the site. The default theme will be used by the system in all situations in which another theme is not specified. If we click the Default radio button next to our new theme and click Save Configuration, the theme will be applied immediately, for both front end and back end of the site.
Note that you can enable more than one theme at a time. By enabling more than one theme, another function becomes possible. Registered visitors can choose which theme to use when they view the site. When multiple themes are enabled, a registered user can pick a theme as their default theme and the system will remember their choice.
When the multiple theme function is active, site visitors can select their preferred theme via the Theme configuration preferences on the edit tab of the My account page. This functionality can be disabled by the administrator.
Note that once you enable a theme, another choice appears on the Theme Manager interface. Enabling a theme causes the Configure option to become active (it will appear to the right of the Default radio button in the column labeled Operations). The Configuration Manager provides access to both global configuration options and theme-specific settings.
Uninstalling themes is a simple process, essentially the reverse of installing. First go to the Theme Manager and make sure that the theme you wish to install is not currently enabled. Once you have verified that it is disabled, then access your server. On the server, find the directory containing the theme files and delete the files and the directory. That's all there is to it!
Note that Drupal is very forgiving, and erroneous deletion of an active theme will not crash your site, it will simply result in the content being shown without any styling.
eBook Price: $23.99
Book Price: $39.99
About the Author :
Ric Shreves is a web applications consultant and tech author. He’s been building websites since the mid-90s and writing about tech for almost as long. Ric specializes in open source content management systems and has written texts on each of the big three: WordPress, Joomla! and Drupal.
Ric is the founding partner of water&stone, a digital agency that focuses on new media and online marketing. He works with clients on digital marketing strategy and supervises the SEO implementation team. Ric lives in Bali and divides his time between the island and Singapore.