How to print a region in views.tpl.php? I have a views-view-unformatted--viewsname--attachment.tpl.php. I want to print region in this file.

I added 

function mytheme_preprocess_views_view(&amp;$vars) {
   if ($blocks = block_get_blocks_by_region('regionname')) {
      $vars['region'] = $blocks;
  }
}


to template.php.

and added

echo render($region);


to views-view-unformatted--viewsname--attachment.tpl.php but print nothing.

What is wrong? How can I print region in views.tpl.php?

i tested this with mytheme_preprocess_html and html.tpl.php and it worked.
Create a new region in your theme's .info file.

regions[RegionName] = Region Name

Insert following code in your
views-view-unformatted--viewsname--attachment.tpl.php template file
to insert region between views rows:

print render(block_get_blocks_by_region('RegionName'));

And then put your block into this region.


For more reference go to this.