Chapter 13. Theming

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • Theme configuration and settings

  • Installing new themes

  • Creating your own custom theme

  • Adding or overriding CSS and JavaScript files

  • Modifying Drupal's HTML structure with .tpl.php files

  • The Theme developer module

  • Sub-themes

  • Template.php, template suggestions and function overrides

There comes a time in every web development project when you take a step back from your work and stare in awe at the functionality. It does everything that you, or your client, asked for and more. Your site has the power to connect people and/or convey information in a way that is completely unique. But your site has one major flaw. It looks just like every other Drupal site.

The common criticism of using a standardized web development platform is that it will look like every other site. With Drupal, nothing could be further from the truth.

Theming is the term used to describe the act of modifying a site's layout, color scheme and, possibly, its HTML structure. Drupal has been written in such a way that the core functionality and modules (the gears) of a site and its output are separated. Some have referred to Drupal's architecture as a Model-View-Controller (MVC), while others have said it is a Presentation-Abstraction-Control (PAC). Regardless of how it is described, what should be understood is that Drupal separates the handling of data from the presentation of data.

One way to visualize this separation is to think of a chocolate factory. On one end of the ...

Get Beginning Drupal® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.