This module is great! I have always wanted to have blocks inside nodes. Great for related blocks, info about author, etc.

It would be even greater if it could be called from for example node.tpl.php - so that all nodes would have a block inside it describing the author of that node or whatever. Less work for admins and users alike.

Is it possible?

Comments

eaton’s picture

Status: Active » Closed (won't fix)

Inserting the contents of a block into your node.tpl.php file using a bit of PHP is actualy pretty easy:

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

insert_block is unique, though, in that it allows you to insert the contents of a block into the actual BODY of a node, rather than just the layout wrapper around it. There's no way, as far as I know, to do that with the node.tpl.php file.

If you're looking to generate dynamic content and related-articles lists etc, I'd recommend checking out the Views module. With a bit of PHP, it can create dynamic lists of contents (like 'other articles by this author' or 'articles about this topic' lists) and render them however you'd like.

lennart’s picture

The tip works perfectly! Thanks Eaton!