Print block in node

If you want to print block in node (node.tpl.php) or page template, you can use following functions:

module_invoke

<?php    
              $block = module_invoke('views', 'block', 'view', 'related_content-block_1');
               print '<h3>'.$block['subject'].'</h3>';  // block title
               print $block['content'];  // block - view content

?>

if you need to apply some arguments to show view you can use this code:

views_embed_view

<?php    
           $block = views_embed_view('related_content', 'block_1', $node->nid);    
           print '<h3>'.t('Block title').':</h3>';
           print $block;     
                             
?>

 

Wiki Tags: 

Testimonials

What I came with as basic idea, HalfPixel transformed into complete web.

Richard Rybnicek, pozdravdoneba.sk

Are you around here?

When you`re not far, come visit us.

Contact