YouTube BBCode (W3C-compliant!)

MobileHacks

New Member
YouTube BBCode tag here, but every single one of them uses the embed tag, which is an illegal XHTML tag. I set out to find a way to create a W3C-compliant YouTube BBCode tag, and this is what you see here. Note that the text "BORKED" is displayed when the YouTube video can't be displayed (it's the equivalent of the HTML img tag's alt attribute). Obviously feel free to change this to whatever alternate text you want.

Title: YouTube
BB Code Tag Name: youtube
Replacement:
PHP:
<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/{param}" width="425" height="344"><param name="movie" value="http://www.youtube.com/v/{param}" />BORKED</object>
Example: [youtube]dMH0bHeiRNg[/youtube]
Description: Embed a YouTube video. You <b>only</b> put the video ID in between the BBCode tags (<b>NOT</b> the full URL!). Embedding <b>must</b> be enabled for the video!
Use Option: No
Image:
youtuberi3.gif
 
When you add the bbcode, you can the use just this code in your posts and it should play the video.

[youtube]videocode[/youtube]
 
Is it possible to change this so users can add the full youtube url? My users are mainly not very PC literate. :)
 
I wish to use this code so it only shows clips uploaded to my site would i be correct in doing this?:

<object type="application/x-shockwave-flash" data="http://www.mysite.com/{param}" width="425" height="344"><param name="movie" value="http://www.mysite.com/{param}" />FAILED TO LOCATE CLIP. PLEASE TRY AGAIN</object>
 
my site swf movies full screen code not work this code help please

<object type="application/x-shockwave-flash" data="http://www.mysite.com/all/film/{param}" width="425" height="344" allowFullScreen="True"><param name="movie" value="http://www.mysite.com/all/film/{param}" allowFullScreen="True"/>BORKED</object>
 
Back
Top