Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal 7 custom template file for certain content type

i am currently working on a drupal 7 project. I wrote a custom template for a certain content type. The file is named correctly node--type.tpl.php and it's displayed correctly too. but the other regions and blocks are not visible. other custom templates show all regions and blocks. I'd like to mention two things,

  1. i'm not a drupal lover/hero
  2. i'm expanding an existing project.
like image 635
eyurdakul Avatar asked Feb 04 '26 13:02

eyurdakul


1 Answers

A few things to check:

  • Make sure you've also copied across the core node.tpl.php file to your theme folder; the template overrides for nodes won't work without it.
  • Make sure your file is properly named, e.g. for a content type with the name of home_page the template file will be called node--home_page.tpl.php.
  • Make sure you've cleared Drupal's caches since adding the new template files; the theme registry is cached so a clear is necessary to pick up changes.

See Drupal 7 Template (Theme Hook) Suggestions for more information on the general subject.

As an aside, the node template file doesn't have any blocks/regions in it, they will always be contained in page.tpl.php, or some derivative.

like image 79
Clive Avatar answered Feb 06 '26 01:02

Clive