Drupal 6 Themes

Learning the many ways to theme with Drupal 6

By: Staff


Packt's new book, Drupal 6 Themes, takes the reader though the process of creating themes for Drupal 6. It does this by first giving an overview of how themes work in Drupal, then what exactly can be themed and finally takes the reader though several examples.

What is Drupal?
Essentially Drupal is a very flexible content management system that has been in development since 2001. One of its strengths is allowing users to modify much of its look and behaviour by over-riding default actions. This allows developers to concentrate on what they want to change and leaving the rest as is-- a method that will be familiar to users of some frameworks. Themes in Drupal are a collection of files organized in their own directory controlled by a template engine that processes the files. While the book does touch a fair bit of Drupal's structure, themes only really control the presentation layer, so this is not the book if you want to write your own extensions modules.

How themes work in Drupal
The first two chapters cover what Drupal themes are and how the reader is going to work with them. With any content management system (CMS) there are limits to what can be altered without diving into the core of the application. Having once contracted for a company who had done just this and is now probably stuck with their own custom version of Drupal 5, this is something you want to avoid. At the same time, you don't want a web developer able to pick out your CMS from 20 paces-- not to mention your graphic designer isn't going to be too happy to be told every layout they do will have 3 columns and a blue gradient.

The good news is Drupal has a theming system that lets you put not only layout changes, but functionality changes together into a theme in its own directory, keeping your modifications together in one place and making it easy to distribute it. A bit like some other frameworks, it has a well though-out system where your theme can override certain Drupal defaults, be they style-sheets or functionality, while keeping Drupal's defaults intact for the parts you don't want to modify. By the end of chapter two users are already going to be able to install new themes and made minor changes to them.

What exactly can be themed?
The next part starts with an overview of template engines, concentrating on PHPTemplate and pure PHP templates. Drupal supports a number of template engines, though only PHPTemplate and pure PHP templates have examples given. At first I found PHPTemplates confusing-- after all the code looks exactly like regular PHP-- but the confusion comes from the name: PHPTemplates are not a new language, but more of a way of organizing files so that installing and un-installing can be done from Drupal's administration interface. These template engines are covered in chapter three and they give a bit of an overview of PHPTemplates and plain PHP templates for examples.

This is followed by a guide to what files control what aspects of the standard modules (polls, forums, blog, etc.). Drupal has a large number of files -- about 40 CSS files alone -- so a fair bit of time can be saved by knowing where to look. Finally, Drupal's overrides and intercepts are covered in chapter five.Intercepts are how to modify things people see on the screen, while Overrides are for making changes to default Drupal functions. Overrides and intercepts are the proper way to modify the look and functionality of Drupal, so it's an important chapter to understand. By the end of these chapters readers are going to know where to look to start modifying themes and what the process is.

The the chapters that follow are practical examples of theming. Using the Zen template, the reader is guided though modifying an existing template and creating a new template using both PHPTemplates and regular PHP. Along the way Shreves does mention a couple of tools useful for designing themes and appendix B also lists some Drupal modules which are useful. Later chapters cover theming forms and dynamic templates (those that change according to user or programmatic settings), so the reader should emerge with a pretty good idea how to proceed on to their own templates.

The book gives a reader an overview of how themes work in Drupal, what can the themed and provides examples of theming the standard Drupal modules. By the end of the book readers should be familiar enough to create themes in Drupal. The book then ends a bit abruptly with two appendix on the contents of the various Drupal style-sheets and some tips on tools to use for theming. Drupal has a large number of files, so a few of the chapters and the first appendix serve as a reference as well, making it a good book to keep around after you've finished the examples and are working on your own themes.

Date published: 07-Nov-2008





Front End Drupal

Tools and techniques for learning to create themes for the Drupal 6 CMS.

Drupal's Building Blocks

One question that is going to come up is how current is this book with the recent arrival of Drupal 7? With the exception of CCK, most of the content is still relevant.

The Definitive Guide to Drupal 7

If last-year's Professional WordPress is the must-have book for WordPress developers, then Definitive is at least the equivalent for Drupal developers.

Sam's Teach Yourself Drupal in 24 Hours

If you have 24 hours to spare, why not learn Drupal?


2019 YYZTech

For American computers stores, visit: AmericanComputerDealer.com