0

Scenario:

I have a basic node content type that has some fields. I also have a custom block that will appear in the content-region of this node content type.

How can I (is it possible) reference the rendering of the block from within the theme node--mycontenttype.tpl.php file?

1

In Drupal 6, you can do something like this:

$block=module_invoke(MODULE_NAME, 'block', 'view', BLOCK_NAME);

and now $block['content'] will contain the html content of BLOCK_NAME defined within MODULE_NAME.

I just noticed the -- in your template name, so in Drupal 7 it would be:

$block=module_invoke(MODULE_NAME, 'block_view', BLOCK_NAME);

and more details can be found here.

1
  • This worked perfectly, exact solution to my problem. Thanks a ton! Jul 24 '12 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.