How to put a block inside an article in Drupal

As a Joomla developer I usually put a module inside an article using loadposition code. The code is pretty simple: {loadposition position_name}, but I can’t find this functionality in Drupal 7, I don’t know how to put a block inside an article in Drupal. So I ended adding this code to the page.tpl.php in my template.

As you can see from this code, it will search for this pattern: {loadposition position_name} from the content of article or basic page, and get the value of position_name. Then it will load the block by region name using function block_get_blocks_by_region and replace this string: {loadposition position_name} with the block content.

Hope this help someone

Leave a Comment

Your email address will not be published. Required fields are marked *