开发者

How do i find the id of a drupal block-id if i know it's block-description

In a specific template i want to use a block, so it's contents can be edited by an editor for all content using that template.

Because the setup is multisite i cannot use the block-id(bid). The id of the block is different for different sites.

Is there a way retrieve a blockid for a 开发者_运维百科block description via the API?

I could use a SQL query on the prefix_boxes table, but would prefer to use a documented API.

I'm currently using the code below on Drupal version 6.

$block = module_invoke('block', 'block', 'view', 7);
print $block['content'];


You can use block_list (Here is the documentation for it: http://api.drupal.org/api/drupal/modules--block--block.module/function/block_list/6) to retrieve the block list per region, there you should find your block id by the description.

But writing your own query isn't bad solution in this case, For my opinion at least.


You do not want to use the block, but a region itself. You can achieve this using the _preprocess_nodehook, adding the region in the .info and printing the region in your template.

By the way, the trick than Ran published is quite interesting as you can use this to write your region in virtually any part of a Drupal site.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜