How to display a view within a template only if there is something to display I'm looking to embed a view within a template file BUT only if there is something being returned within the view.

I'm using this solution that I saw within the Drupal forum:

&lt;?php
 $view = views_get_view_result($name, $display, $args);
 $result = count($view);
?&gt;


&lt;div class="row"&gt;
    &lt;div class="col-xs-12 related-articles"&gt;
      &lt;?php if ($result) : ?&gt;
        &lt;h3&gt;Related Articles&lt;/h3&gt;
        &lt;?php print views_embed_view('related_articles', 'related_articles'); ?&gt;
      &lt;?php endif; ?&gt;
    &lt;/div&gt;
  &lt;/div&gt;


So is this the right way to check if that view is returning anything? Or am I missing something there?
Instead of embedding a view in a template, please consider having your view output a block display, which you can place on your site using the Block System, Panels or Context.