开发者

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)


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:

  • How to build your own sub-theme (6.x-2.x)
  • How to build your own sub-theme (6.x-1.x)


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜