开发者

Drupal calling a block programmatically, block title not displaying

I tried calling a block programmatically bu开发者_高级运维t it's not displaying the block title. I added a block from the "add block" page. It has an id of 53.

I have this code in my page.tpl.php or node.tpl.php:

<?php  
$blockTest = (object) module_invoke('block', 'block', 'view', 53);
print theme('block', $blockTest);
?> 

It does show the contents (body) of the block, but not the block title (subject). Any ideas why?


This appears to be a bug in Drupal core, at least in my reading of http://drupal.org/node/162899 and a potentially related issue at http://drupal.org/node/521668 The first one has a proposed patch, but it's a bit outdated, and will cause the update script to break. You can change the function in update.php after applying the patch to a number higher than what your current version is, but that might be a lot to ask. Even then, I couldn't get it to work.

Adding a cross-reference to your comment at http://drupal.org/node/26502#comment-3781716 which asks the same question.


You should have a look at the block_load() function, it might help you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜