Forums / Cotonti / Support / Youtube bbcode

change bbcode

Twiebie
#1 2010-09-09 14:22
I would like to change the YouTube bbcode from [youtube=] to the normal way of inserting the link between tags like this: [youtube]www.youtube.com/video[/youtube]. Can anyone give me some assistence on this?

The YouTube bbcode at the moment:
\[youtube=([^\s"';&\?\(\[]+)\]

What do I need to change?
ez
#2 2010-09-09 14:43
BBcode: youtube
mode: PCRE
structuur: \[youtube\]([^\s"\';&\?\(\[]+)\[/youtube\]
container: (mark this checkbox)
replacement:
<object width="290" height="233"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="290" height="233"></embed></object>

for other sizes, just change width and height in the replacement section
==- I say: Keep it EZ -==
Twiebie
#3 2010-09-09 18:10
Thanks for the reply, but it's not working?

I'm using that bbflow plugin, is there a way to insert the normal url instead of the last bit of the url for all the video websites that are included in the bbflow plugin? Most members on my website are used to copy/pasting the whole url between the [youtube] [/youtube] tags.
ez
#4 2010-09-09 21:33
bbflow ????? I do not know this one..
You can do it with the regular bbcodes.

Did you check the container checkbox !
code should be like this: [youtube]79PIIl0B2uM[/youtube]

Also I made an integration into the editor (markitup) with a button that asks you for the code... :)

greetz,

ez
==- I say: Keep it EZ -==
Twiebie
#5 2010-09-09 21:59
This plugin: http://www.cotonti.com/forums.php?m=posts&q=2227&d=15

Yes, I checked the container checkbox.

Let me explain it once more, just to be clear.

Now the code is for example:
[youtube=WoAXW30mMAg]
But I would like it to be:
[youtube=http://www.youtube.com/watch?v=WoAXW30mMAg]
or:
[youtube]http://www.youtube.com/watch?v=WoAXW30mMAg[/youtube]

Now visitors need to copy paste the last bit of the url instead of the whole url, which is a bit confusing for most people since on most forums you just copy/paste the whole url in to youtube tags.

Any ideas how to get this to work?
ez
#6 2010-09-09 22:23
Try this:

use:
\[youtube\](.+?)\[/youtube\]

use replace:
<object width="290" height="233"><param name="movie" value="$1"></param><embed src="$1" type="application/x-shockwave-flash" width="290" height="233"></embed></object>
==- I say: Keep it EZ -==
Twiebie
#7 2010-09-09 22:29
That just gives a white box.
ez
#8 2010-09-10 03:40
what is the html code for this box?
==- I say: Keep it EZ -==
Twiebie
#9 2010-09-13 20:52
# ez : what is the html code for this box?

<p>
<object width="290" height="233"><param name="movie" value="http://www.youtube.com/watch?v=mnt30iJfMM8"></param><embed src="http://www.youtube.com/watch?v=mnt30iJfMM8" type="application/x-shockwave-flash" width="290" height="233"></embed></object>
</p>

When clicking right mouse button on the white box it's saying: Movie not loaded..
ez
#10 2010-09-13 22:32
He tweebie,

ahh I see where it goes wrong..

http://www.youtube.com/watch?v=mnt30iJfMM8
is a full youtube interface with stuff in the screen

You want only the movie in a box, so that is this url.
http://www.youtube.com/v/mnt30iJfMM8 geeft

You have to change this regexp
\[youtube\](.+?)\[/youtube\]

You have to experiment with that a little, because My regexp is not realy great.

try something like:
\[youtube\][www.youtube.com\/watch\?v=](.+?)\[/youtube\]

This is my best guess.. try it, and fiddle with it

The replace must be:

<object width="290" height="233"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="290" height="233"></embed></object>
==- I say: Keep it EZ -==
pieter
#11 2010-09-14 02:05
For one reason or another.
It is not working anymore for me.

Can we clear somewhere the cache for this?

I deleted the item in BBcodes, cleared HTML cache on the bbcode page and cleared the intern cache under admin/others.

Then recreated it and it worked.

\[youtube\](.+?)\[/youtube\]

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" width="425" height="344"><param name="movie" value="http://www.youtube.com/v/$1" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /></object>


Added 14 seconds later:

Hope this helps you
... can we help you ...
This post was edited by pieter (2010-09-14 02:12, 13 years ago)
ez
#12 2010-09-14 03:18
hey pieter,
I see you are using my original bbcode :)
I will try to make a bbcode that works both for a url and for a code alone.. (regexp)

Cache problems... I too have them sometimes, I always clear cache things when I worked on bbcodes..
It is so automatic for me, that I forgot to mention it... thnx
==- I say: Keep it EZ -==