Book Image

Instant Premium Drupal Themes

By : Pankaj Sharma
Book Image

Instant Premium Drupal Themes

By: Pankaj Sharma

Overview of this book

Drupal’s theme layer, and the themes that use it, are responsible for the look and feel of a Drupal web site. Themes have the final say and ultimate control over almost every aspect of each page. Good themes consist of all the same elements that you would find on any reputable web site, including standards-compliant XHTML markup, CSS, and JavaScript. How it all comes together is what is so special and what makes Drupal themes so flexible and powerful. Premium Drupal Themes is a practical, hands-on guide filled with clear, step-by-step examples which shows you how to create Drupal themes using HTML. This book will show you the best practices and conventions that you should adopt and utilize so you can change the way Drupal looks using HTML without wasting energy digging through Drupal’s code. Starting with the essentials including Drupal terminology and Drupal theme structures, this book will show you how to configure raw HTML in a Drupal environment. You will learn about the Drupal template variables and also how to populate a Drupal theme with dynamic content. You will also discover how to customize the search result page and how to add regions to your home page. This book will help you familiarize yourself with the theme engines and will help you learn about the core of Drupal’s theme rendering system. Finally, you will learn how to create your very own Drupal theme that will take people’s breath away!
Table of Contents (7 chapters)

Breaking down HTML in parts (Intermediate)


While customizing the Drupal theme, we need to use Drupal's built-in functions and variables.

If there is a need to create theme-specific functions and methods, then that can be done in the template.php file located in Drupal's themes folder.

Availability of these variables depends on whether they have been enabled in the Admin panel or not.

To populate a raw HTML file with dynamic content, you need to use Drupal variables.

These variables can be found at the following link (the user can refer to API to know the details of the Drupal variable):

https://api.drupal.org/api/drupal/globals/7

We need to configure the .info file. This file has key-value pairs with the keys on the left and the values on the right. Semicolons are used for comments.

The following information is provided in the .info file:

  • Name of the theme

  • Description of the theme

  • Version of the theme

  • Stylesheet to be used in the template

    You can get more information about the .info file at

    https://drupal.org/node/171205

How to do it...

We can configure HTML in Drupal by performing the following steps:

  1. Break down your HTML code as per the Drupal templates.

  2. You need to identify the header, footer, and body part with your HTML code.

  3. Configure CSS in the .info file. A CSS file will be picked up from this path. Start populating HTM using the Drupal variable.

  4. Write down the .info file or make changes in the .info file of the garland theme as per the new theme.

  5. Click on the Clear all caches button located at Administration | Configuration | Development | Performance.