4

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(&$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.

1 Answer 1

3
  1. Create a new region in your theme's .info file.

    regions[RegionName] = Region Name
    
  2. 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'));
    
  3. And then put your block into this region.

For more reference go to this.

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.