tags:

views:

17

answers:

1

Hello

I know how to get block data by module_invoke(),

but how to use standard block theme for rendering it.

I tried to use theme() function but with no success.

Could somebody give me advice?

Regards

A: 

Taken from the API comments for theme_block

// setup vars
$module = 'system';
$delta = 0; // could also be a string

// renders the "Powered by Drupal" block
// @see hook_block()
// @see module_invoke()
$block = module_invoke($module, 'block', 'view', $delta);

// must be converted to an object
$block = !empty($block) ? (object)$block : new stdclass;

$block->module = $module;
$block->delta = $delta;
$block->region = 'whateverYouWant';

echo theme('block',$block);

Haven't tested it but it seems to be doing what you want. This uses the regular theme function to theme the block you are retrieving

DrColossos
Thanks a lot. Only difference is passing block id instead of delta.
AnotherDrupalNewbie