I've added a series of blocks to my template file for a specific content type. These blocks are built in Views and they show Downloads filtered by the specific content you are viewing. For example, on the Product A page, the Product Literature block shows all downloads categorised as Product Literature specifically associated with Product A.
There is a block for Product Literature, a block for Videos (set up in a similar way) and a block for Publications (again, set up in a similar way).
At the moment, if there aren't any videos for Product X, the heading Product X still displays for Video Gallery, is there a way I can detect if there is any content under the Video Gallery heading and if there isn't, choose not to display it?
Each block is printed as below:
$block = module_invoke('views', 'block_view', '712046d635e195e59dd93bd378e45423');
print "<h2>Product Literature</h2>";
print render($block);