Convert any website layout or template into a drupal theme – easily

Theming for Drupal is not actually as hard as you may think. Certainly there are more advanced areas of theming possible with Drupal, which may or may not be necessary depending on the needs of your site or whether there are subtle defaults which you wish to change (and which you can learn about if and when they become necessary for your site). Creating the “overall theme” for your site though is very simple.

A Drupal theme is nothing more than a standard website layout, with a few bits of PHP code added in certain places, which you can simply copy/paste into place in order to call up Drupal’s “dynamic” content and features in those spots.

If you learn better visually, videos are available which cover much of the same information that will be illustrated here: Acquia Webinar.

Contributed/downloaded themes are more complex than “your” theme needs to be

You may have looked at various pre-made themes that either come with Drupal core or are available for download, and sighed with frustration upon seeing their code. To some, the code looks very confusing.

Keep in mind that those themes have been created to address the needs of many people. The themes must be able to handle all kinds of scenarios, which means they have been designed to allow you to dynamically add various columns and other layout elements, and to support custom theming for features and modules which you might not even need. These themes usually include a large amount of PHP code that essentially says, “If this setting is true, then show this part this way, or else show that.” This makes the theme very flexible, but also very complicated.

However, your theme doesn’t need to work for everyone. It only needs to do the things your site requires and nothing more. All that you need are a few bits of PHP, which you can simply copy and paste into your own HTML template. These PHP snippets tell Drupal to load its

dynamic content in those spots.

You might also find it useful to have a look at Drupal’s “most basic” core template files (those used when a theme doesn’t provide any alternative template files to override them). To view these basic templates, look in the /modules/system folder of your Drupal installation (in particular, look at page. tpl. php and node. tpl. php).

Just a few simple & basic elements make up a Drupal theme

The “main” template file in Drupal is called page. tpl. php. Make a copy of your website layout/template and call it page. tpl. php. Then, simply paste the following bits of code into your layout, in the locations noted (all the code mentioned in this lesson goes in the page. tpl. php file).

Starting your page
If you’re using Drupal 5:


Menu system / navigation
Drupal’s default menu for your site’s content is called Primary Links. There is also a Secondary Links menu which can show related sub-pages under the Primary menu. When stripped of all images and styles, a menu in Drupal is nothing more than a nested unordered list, in plain HTML, with links for each list item. You can use CSS to style a menu in any way you want; changing how it looks, whether it is horizontal (like tabs) or vertical, etc.

To make the Primary and Secondary Links menus appear on your site, paste the following into either the top area of your theme (for instance, if your menu is going to be styled as tabs or buttons), or in the sidebar area (for instance if you plan to have your menu show vertically in the sidebar).

Simple way:

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Convert any website layout or template into a drupal theme – easily