php - I am writing a script to embed Youtube or vimeo videos into magento product page -


youtube embed code has letters , vimeo embed code has numbers example v?cvxmbd5 , vimeo vimeo.com/6847539 . writing script pull end of embed strings letters match top iframe , pull end of embed strings no letters match bottom iframe.

this script supposed embed videos video tab on product view page.

<?php $_product = $this->getproduct(); if ($_product->getvideo()) $videos = explode(', ', $_product->getvideo());  foreach ($videos $video) {  if (ctype_digit($video)) { echo "<iframe width = '560' height = '315' style = 'max-width:100%;' src = 'https://player.vimeo.com/video/" . $video . "' frameborder = '0' allowfullscreen></iframe>"; } else {     echo "<iframe width = '560' height = '315' style = 'max-width:100%;' src = 'http://www.youtube.com/embed/" . $video . "' frameborder = '0' allowfullscreen></iframe>";  } }  ?> 


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -