Andrew
Andrew

Reputation: 1252

Template files not being discovered

I was experiencing an odd problem where blocks were not showing up on a site. After a lot of spelunking I have found that block.tpl.php is not getting called/discovered.

Looking at the suggestions that the theme engine is trying to find it looks like the most general template it will look for is block-MODULE.tpl.php - ie if I set up symlinks for block-block.tpl.php, block-views.tpl.php etc then the content will show. It just won't find block.tpl.php

So I can kind of make the problem go away, but I'd feel a lot better if I could fix it properly.

Anyone know why (or where) this would happen?

This is drupal 6, with a zen subtheme. zen is in sites/all/themes/ the subtheme is in sites/example.com/themes/.

(it does seem to be finding page.tpl)

Upvotes: 0

Views: 1241

Answers (3)

Andrew
Andrew

Reputation: 1252

Turns out I had added a to the hook_theme() function in template.php for blocks that was pointing to a different location and confusing everyone.

Why I did that is lost to history, but it seems to server no useful purpose.

Upvotes: 1

Matt Ryan
Matt Ryan

Reputation: 1717

there should be a version of block.tpl.php in both the theme and subtheme directories.

Upvotes: 0

user113292
user113292

Reputation:

PHPTemplate will find the more general templates (e.g. block.tpl.php): you can confirm this behavior by looking in the themes/garland folder which has its own block.tpl.php.

The most common reason for the template engine ignoring your template overrides is because the theme registry has not been reset. You can reset it by going to Site Configuration -> Performance and clicking Clear cached data at the bottom of the page.

Also make sure you've gone through and followed the instructions for sub-theming exactly: missing a step can produce unexpected results:

Upvotes: 2

Related Questions