0

I created a custom views template that I have called views-view--page.tpl.php. Now I would like to add a block into the template file.

In my page template file I was able to render a region and do this:

<?php print render($page['leftsidebar']); ?>

But it seems like this will not work for a views template. I am not the best with PHP so any help would be great!

I'm using Drupal 7.

3

1 Answer 1

1

Using the answer given to me in the comments by @subhojit777 I was able to call it up using this code:

<?php 
  $block = block_load('MODULE_NAME', 'DELTA'); 
  $output =      drupal_render(_block_get_renderable_array(_block_render_blocks(array($block)))); 
  print $output; 
?>

I don't know if this is the best way, but it's working for now. :)

1
  • Can you put a block inside a custom made block? If so how? This doesn't work.
    – user26280
    Commented Feb 11, 2014 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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