0

I have a block with name: "Share Product"(block number 5) generated by my view with name: "main_product_deal". In this view i have 9 blocks.

Now in my .tpl file i need to print this block.

I have seen the function 'module_invoke' but not working. My code is:

//On my tpl file
<?php    
$block = module_invoke('views','block','view',"main_product_deal-block_5");
print $block['content'];
?>

I working in drupal 6.x. Is it correct my code? Or exist another solution? Note: I can not set the block in the administration, because I'm programming certain things in the tpl

Thanks :D

2 Answers 2

1

Have you tried views_embed_view()? http://drupalcontrib.org/api/drupal/contributions!views!views.module/function/views_embed_view/6

0
0

Do you actually need the block, or can you just output the results of the view? If you just need the results of the view:

$view = views_get_view('main_product_deal');
print $view->execute_display('default');
4
  • The param of execute_display is the name of the view or the delta?.. I'll try your solution. Jun 22, 2012 at 17:18
  • Don't work :(. A put this in my tpl file.. but doesn't show the result of the view-block. Jun 22, 2012 at 18:07
  • What does it do? Are there any error messages? More info would be great
    – kevinmcg
    Jul 2, 2012 at 14:46
  • Any errors, only don't show the block. I need to show a block-views in my page-deals.tpl... I need extract only this block. (no the default) Jul 2, 2012 at 16:09

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.