The Drupal theme is located in the themes
folder in the root. Drupal provides some themes by default such as bartik, garland, seven, and stark.
These themes can be used as a skeleton to create your own theme.
We will use the Garland theme as the base theme to explain Drupal in this book.
Garland's templates will be used as the base.
Any Drupal theme consists of the files mentioned in the Getting ready section. These files are needed to create any Drupal theme.
A list of the Drupal theme files and a brief description of their functionalities are discussed in this section.
While creating a Drupal theme, knowledge of each theme file is mandatory. The name of a theme file should not be changed at any cost. Drupal does not understand any other file except its own theme file.
Template name |
Template function |
---|---|
|
This is the gateway of Drupal themes. This file contains information about the theme's name, its version, and its description. Other than this, the theme skeleton is also mentioned here.CSS files are also configured in this file. |
|
Comments inside the content are taken care of by this file. |
|
CSS of the site is placed here. Apart from |
|
This is the main file of the Drupal theme. The Drupal theme revolves around this file. This is pivotal for the development of the Drupal theme. |
|
This file is responsible for the content of the Drupal node. You can say that the node is governed from here. |
|
It is optional but it is advised to have this file, since it is according to Drupal conventions and it provides a face to the theme. |
|
A screenshot of your theme is represented by an image and it helps you to recognize your theme in the Admin panel. |
|
In this file we can write our own theme function. It is advisable to write theme specific functions here. We should not try to hack the Drupal core as it might disrupt Drupal as a whole. |
|
Theme settings and global variables can be defined here. |
|
As the name suggests, this page is displayed when the site is down for maintenance. It's optional, but recommended. |
|
This template is used to display a region in the Drupal theme. |
|
This template is used to display blocks in the Drupal theme. |
|
This file can be used to provide instructions to users. |
|
This file is used to display the basic HTML structure of a single Drupal page. |
We need to perform the following steps:
Download the latest version of Drupal from https://drupal.org/download
Install Drupal (follow the instructions to install Drupal at https://drupal.org/documentation/install)
Supposing your installation name is
drupal
, go togarland
in thethemes
folder.You can find all the necessary Drupal templates at
drupal\themes\garlandpath
.