title: I am writing a script to embed Youtube or vimeo videos into magento product page
body: <p>Youtube embed code has letters and vimeo embed code has numbers example v?cVxmbd5 and Vimeo is like Vimeo.com/6847539 . I am writing a script to pull the end of embed strings with letters to match it with top iframe and pull end of embed strings with no letters to match with bottom iframe. </p>
  
  <p>This script is supposed to embed videos into a video tab on the product view page. </p>
  
  <pre><code>&lt;?php
  $_product = $this-&gt;getProduct();
  if ($_product-&gt;getVideo())
  $videos = explode(', ', $_product-&gt;getVideo());
  
  foreach ($videos as $video) {
  
  if (ctype_digit($video)) {
  echo "&lt;iframe width = '560' height = '315' style = 'max-width:100%;' src = 'https://player.vimeo.com/video/" . $video . "' frameborder = '0' allowfullscreen&gt;&lt;/iframe&gt;";
  } else {
  
  
    echo "&lt;iframe width = '560' height = '315' style = 'max-width:100%;' src = 'http://www.youtube.com/embed/" . $video . "' frameborder = '0' allowfullscreen&gt;&lt;/iframe&gt;";
  
  }
  }
  
  ?&gt;
  </code></pre>