Understanding the anatomy of a theme
Drupal themes can consist of a multitude of files each with its own purpose, format, and syntax. This recipe will introduce each of these types with an explanation of what they do.
Getting ready
It will be useful to navigate to the Garland folder at themes/garland
to browse and view the files inside a typical, fully featured theme. Garland also uses the PHPTemplate theming engine which is the most commonly used and recommended engine across Drupal's core and contributed themes.
How to do it...
The following table outlines the types of files typically found inside a theme's folder and the naming conventions to be followed for some of them.
Type |
Mandatory? |
Description |
---|---|---|
|
Yes |
Configuration file which provides information to Drupal about a theme named mytheme. |
|
Yes |
A template file which determines the layout of all Drupal pages. |
|
No |
A template file which determines the layout of a node inside a Drupal page. |
|