About theming

Last modified: December 2, 2008 - 20:59

A "theme" is a collection of files that define the presentation layer or "look and feel" of a Drupal site. A theme specifies both the underlying page structure (the regions of a browser page where content can be placed), the cascading style sheets (CSS) that control fonts, colours, etc. and possibly JavaScript (commonly used to create dynamic page elements).

A theme can also be used to override (modify or replace) the text and variables that are generated by modules. For example, a theme can be used to replace the default label on the Search button or to hide and display certain fields that are part of a particular content type. You can also override the default CSS classes that might appear in your content.

Often a theme is used simply to define the look and feel of an entire site, but it can also be used to customize the look and feel of certain sections of a site, of certain types of content, and even of individual nodes or pages. For example, your theme could specify a different look for the front page of your site.

Depending on the kind of theming work you are doing, you will need some knowledge of the following subjects:

  • xHTML and CSS.
  • JavaScript and jQuery (only if your theme needs scripting).
  • The terminology used in Drupal.

A basic knowledge of PHP is needed for some tasks, but it is possible to avoid it entirely, especially if you do not have a need to override functions.

If you ever get stuck on a problem, read the best practices page, check the troubleshooting FAQ, ask in the theming forum or on IRC @ #drupal-themes. See How to effectively use IRC for instructions. You can also view a number of theming videos which guide you through common scenarios.

For information on where to install a theme, see the installing themes page.

If you are developing a module that outputs presentation data, then please read the theme section in the module developers guide. All output should be themable.

 
 

Drupal is a registered trademark of Dries Buytaert.