[tutorial]Another My Youtube Code
#1
I saw some youtube mycode on the board but this is a different one.
this MyCode will allow you to copy full URL of youtube and just put in MyCode like that

[youtube]http://www.youtube.com/watch?v=xxxxxxx[/youtube]

Go to ACP -> Configuration ->MyCode -> Add New MyCode

And put the following values to your new Mycode:

Title
Youtube
Short Description
youtube video code
Regular Expression
\[youtube\]http:\/\/(.*?)youtube.com\/watch\?v\=(.*?)\[/youtube\]
Replacement
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/$2"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$2" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
Enabled?
yes

Save it and it was!

For testing

Test Value:
[youtube]http://www.youtube.com/watch?v=sZp3Gjpltc4[/youtube]

^^mike16os


Attached Files Thumbnail(s)
   
Reply
#2
Worked fine, gretly explain, thankx dude
Reply
#3
Does it support International Youtube considering there are a lot of UK members on forum and members from other countries.
Reply
#4
(2009-03-24, 01:23 PM)Hapatio Wrote: Does it support International Youtube considering there are a lot of UK members on forum and members from other countries.

Yes it supports international youtube URL.
It was testing with de.youtube.com
But it also shold work with all kind of xx.youtube.com subdomain.

^^mike
Reply
#5
Thank you very much! This mycode works! I had a plugin for this and the video wouldn't play. Thanks!Wink
[Image: tf_468x60_v2.gif]
Reply
#6
Good idea,

thanks... Smile
Reply
#7
Small question if I may. How would I add a MyCode button for YouTube?
Kindest regards,
John
Reply
#8
(2009-06-21, 09:12 AM)John Briggs Wrote: Small question if I may. How would I add a MyCode button for YouTube?

http://community.mybboard.net/thread-12693.html
Reply
#9
The regexp I wrote looks like this:

\[youtube\](.*?)(youtube.com/watch\?v=)?([A-Za-z0-9\-\_"']+)[&\w;=\+_\-]*\[/youtube\]

I pull argument $3. The regexp will match and extract your movie id from any of the following (since so much is optional):

http://www.youtube.com/watch?v=sZp3Gjpltc4&feature=fvw
http://www.youtube.com/watch?v=sZp3Gjpltc4
www.youtube.com/watch?v=sZp3Gjpltc4
de.youtube.com/watch?v=sZp3Gjpltc4
youtube.com/watch?v=sZp3Gjpltc4
sZp3Gjpltc4

The single and double quote chars are not valid characters in the movie id, but they are in my expression so that people can't inject code into the object tag.
Reply
#10
shiphorns, dont work for me Sad
vBulletin/Wordpress/Magento/MyBB
Developer and Designer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)