Drupal Theme from Scratch Drupal Theme from Scratch icon
Theming a Drupal 7 Website



More Drupal 7 Theme Templates

There are more template options than just the basic list I showed you before. Each one of those generic templates I listed in the hierarchy have brothers and sisters. And each set of siblings follows its own hierarchy...

  • page--node-32.tpl.php (template for a specific node ID)
  • page--event.tpl.php (template for a specific node type)
  • node--102.tpl.php (template for a specific node ID's content)
  • node--event.tpl.php (template for a specific node type's content)
  • node.tpl.php (generic node content template)

Drupal will use the most specific template it finds. If no specific templates exist in your theme, Drupal will work its way down your theme's heirarchy. ID number based templates are the most specific, allowing us to create a template for an individual node. Node type based templates will cover all nodes of a particular content type.

There are ways to avoid having to create such specific templates using IF/Else PHP statements. I'll explain in a bit.

That's just a small list. There are templates for specific regions, fields, blocks, comments, taxonomies, views... Drupal lets you get very specific.

Templates cannot use dynamic path aliases, like those generated by the Pathauto module, in their names.


*If you do not see the social network icons here, it is because you have an ad-blocker running. Deactivate it for this site if you want to share this link. It is safe. There are no ads on this site.

This documentation is a work-in-progress. As I continue to learn more about the software, I will try to keep this documentation updated. I'm no expert of anything, so if anyone feels they need to correct me about something I've written or wish to add some additional tips, feel free to mention it in the comments.

"Drupal 7 Theme from Scratch" was written by TenTen71 because no one else would.