Tuesday, January 10, 2012

Theming nodes based on content type in Drupal 7

*The file node.tpl.php is used to theme certain types of nodes.

*This file will be in module/node folder in the root directory.

*To theme individual content types in different ways, you need to create a file node--[type].tpl.php in your theme's folder & copy the content from node.tpl.php to this file, where [type] is the machine readable name of the content type

*only diference between Drupal 6 & Drupal 7 is ,Drupal 7 use two hyphens

node--story.tpl.php
Themes only Story type nodes.

node--forum.tpl.php
Themes only Forum type nodes.

No comments:

Post a Comment