Note that there are some explanatory texts on larger screens.

plurals
  1. POUser-embedded YouTube videos not displaying
    primarykey
    data
    text
    <p>So I'm trying to implement a feature in my website which would let users embed their own videos. I've been using PHP for it since it's worked for me with other similar goals in the past.</p> <pre><code>$find = array("[video]","[/video]"); $replace = array("&lt;iframe width='560' height='315' src='","' frameborder='0' allowfullscreen&gt;&lt;/iframe&gt;"); echo str_replace($find,$replace,"" . nl2br("" . htmlspecialchars($forumPost) . "") . ""); </code></pre> <p>The two code halves were taken from the YouTube's "embed" option, and simply organized so that the user could put in whatever YouTube URL they wanted and it would display the video.</p> <p>However, I came across a problem when I tested it with this embed code (taken from YouTube):</p> <pre><code>&lt;iframe width='560' height='315' src='http://www.youtube.com/embed/oPmUjjo02bg' frameborder='0' allowfullscreen&gt;&lt;/iframe&gt; </code></pre> <p>This test, oddly enough, works perfectly when I embed it directly into the source code, but leaves a blank box in the page when the same exact code is pieced together by PHP -- in this case, when I'd enter it in the forums like this:</p> <pre><code>[video]http://www.youtube.com/watch?v=oPmUjjo02bg[/video] </code></pre> <p>I've triple checked that there were no errors in spelling or in the URL, itself, so it definitely has something to do with the fact that PHP is putting it together.</p> <p>Nobody else seems to be having this problem, according to the internet, so I have to turn here, as I am completely baffled.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload