Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By efarseer on
I know how to enable blocks in node.tpl.php. Add like below in template.php
function phptemplate_preprocess_node(&$variables, $hook) {
$variables['aregion'] = theme('blocks', 'aregion');
}
But in Drupal7, this way don't work. How to add a block area in node.tpl.php or directly include a block in node.tpl.php of Drupal7.
Thanks very much!!!
Comments
Do you have render($aregion):
Do you have
render($aregion):
in node.tpl.php?Try this one
Hi,efarseer
then invoke this function inside your node.tpl.php
Mayank Kamothi
Thanks a lot for the detailed
Thanks a lot for the detailed description, it helps a lot.
I followed the directions,
I followed the directions, but I'm not getting any output. Any clues?
In template.php:
In my node.tpl.php:
<?php print render($first_block); ?>
Thanks , It works !
2 small comments :
1) Clear your caches before testing
2) There is a duplicate code line in your snippet , It works with only one line of course.