Thursday, May 27, 2010

How do I place a Drupal block's contents into a node?

This works for any content type, and any block
If we wanted to place this custom block into a page, we would simply substitute these values into our PHP code snippet (which we place in a node (page or other content type)) as follows:

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

Notice that the middle two terms ('block', 'view') always stay the same. You're simply updating the first and last term.


No comments: