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.
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 following:
<?php // $Id: node.tpl.php,v 1.24 2010/12/01 00:18:15 webchick Exp $ ?> <div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>> <?php print $user_picture...