How to avoid invoking the same module every time when I have to call a function of that module in Drupal 7? When there is a need to call a function inside a module, some of you say- it is good to use module_invoke() inside the template pages to call the function(it looks great-since I can pass arguments too).

Using Drupal 7. So for the first time, it is okay. Even for the second time, it makes a bit extra effort in the code, but somehow I can manage it.

Now it is invoking again and again, the same module. Say if the module is block, and the function is hook_block_view()- I doubt, it could affect the Drupal site performance(the time for loading the page contents), what do you think?
Is there a solution for this problem?

&lt;?php
  $header_block = module_invoke('block', 'block_view', '2');
  print drupal_render($header_block);
  $news_block = module_invoke('block', 'block_view', '3');
  print drupal_render($news_block);
  ...
  ...
  $footer_block = module_invoke('block', 'block_view', '12');
  print drupal_render($footer_block);
?&gt;



Is it a good idea to use the module_invoke() every time when I have to call hook_block_view() with different arguments?
Is there any other function that can be used for calling the same function or any other function in the module after one- module_invoke()?
Is there any other way of doing thing?
You're calling the same function over and over, that's true. But the parameters are different, so from a pure programming point of view, the processing could be completely different. I don't see another option to approach this.


Is it a good idea to use the module_invoke() every time when I have to call hook_block_view() with different arguments?
Yes
Is there any other function that can be used for calling the same function or any other function in the module after one- module_invoke()? Not that I'm aware of
Is there any other way of doing thing? I don't think so


More specifc, some functions allow passing an array of arguments instead of one. Eg node_load_multiple allows to pass 1 nid or whole list of nids. But hook_block_views doesn't allow this.