O'Reilly logo

Drupal 7 Theming Cookbook by Karthik Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Overriding base theme elements in a subtheme

This recipe details the steps involved in overriding a template file registered by a base theme with an equivalent file in the subtheme. As an example, we will be restructuring the layout of a Drupal node by modifying the node.tpl.php template.

Getting ready

We will be using the mytheme subtheme that was created in the previous recipe.

How to do it...

As we are dealing with a subtheme here, it is by default relying on the template files of its base theme. To override the base file used to theme the layout of a node, copy the node.tpl.php file from the base theme's folder, themes/garland, to the sites/all/themes/mytheme folder. Opening the new file in an editor should bring up something similar to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required