The great thing about overriding the HTML in template files is how totally easy it is. All you have to do is find the default template file, copy it into your theme folder, and edit to your heart's content. Many themes start with these main Drupal core default templates:
page.tpl.php (located in modules/system)
Controls the layout of the entire page. This isn't for the page content type; you can think of it more as the overall screen in which your content types and blocks are displayed. node.tpl.php (located in modules/node)
This is used for the display of each individual node.
block.tpl.php (located in modules/system)
This is used for all of the blocks on the site. comment.tpl.php (located in modules/comment)
Each individual comment is displayed with this file.
box.tpl.php (located in modules/system)
This is a rarely used legacy template. It is used in Drupal core for the container element that surrounds search results and that surrounds a list of comments that is attached to a node.
Just like the node and comment template files, you can find any other templates in the folder of the module that created it. This holds true for core and contributed modules. So, for example, forum templates will be in the forum module folder (modules/forum) and templates for the calendar module will be in the calendar module folder (sites/all/ modules/calendar).
In addition to the basic template files provided by core, there are a number of additional "suggested" templates, such as page-front.tpl.php, which will affect only the layout of the home page of the site. It is also possible to theme content types differently based on using suggested templates. Perhaps blog posts show the author's picture at the bottom, and stories and page posts do not display the picture at all. Content-type-specific templates use the naming scheme node-nodetype.tpl.php, where nodetype is "story," "page," "forum," "blog," or whatever the machine-readable name of your content type is. These machine-readable names can be found in the Type column of the Content types listing page at AdministersContent managementsContent types (admin/ content/types), as seen in Figure 11-9.
For a list of the templates provided by core and the suggested names that you can use, see the handbook page at http://drupal.org/node/190815.
Was this article helpful?