How to hide a block entirely if it's empty
If you create blocks from the views interface itself it will not print the block if there are no results. I would recommend this method since it saves time and complexity. If you need to change the template for the block being created by the view you can do so. There is a lot of documentation on how to do that. Here is an example: Create template file for views block

In the case of what you have written below you could do something like:

$block = module_invoke('views', 'block_view', '712046d635e195e59dd93bd378e45423');
if (isset($block)) {
print "&lt;h2&gt;Product Literature&lt;/h2&gt;";
print render($block);
}


but I would highly recommend the approach above.