Setting up better Youtube tags with MyCode?
#1
I'm trying to set up some MyCode Youtube tags that will allow the embedding of HD videos as well as a larger standard Youtube tag.

At the moment I have:

Regular Expression
\[youtube\]http://www.youtube.com/watch\?v=(.*)\[/youtube\]

Replacement
<center><object width="640" height="390"><param name="movie" value="http://www.youtube.com/v/$1&amp;fs=1&amp;hl=en_GB&amp"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$1&amp;fs=1&amp;hl=en_GB&amp" type="application/x-shockwave-flash" width="640" height="390" allowscriptaccess="always" allowfullscreen="true"></embed></object></center>

Regular Expression
\[hd\]http://www.youtube.com/watch\?v=(.*)\[/hd\]

Replacement
<center><object width="1066" height="600"><param name="movie" value="http://www.youtube.com/v/$1&amp;fs=1&amp;hl=en_GB&amp;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$1&amp;fs=1&amp;hl=en_GB&amp;hd=1" type="application/x-shockwave-flash" width="1066" height="600" allowscriptaccess="always" allowfullscreen="true"></embed></object></center>

For the standard Youtube and HD tags respectively, now these work fine in their own right but if I attempt to use two Youtube tags in the same post the MyCode will break entirely. I can use a Youtube and a HD tag in the same post as demonstrated here but not more than one of each tag.

An example of the code breaking is here.

Anyone have any ideas what I could do?

Also, could anyone advise me as to how I could add the new Youtube tags as buttons to the Advanced Post editor? Thanks in advance!

I also posted this in General Support but I think that might have been in the wrong place Blush
Reply
#2
Replace "(.*)" with "(.*?)" in both regular expressions to make it not greedy.
Reply
#3
Thanks a bunch!
Reply
#4
(2011-06-01, 04:04 PM)CaptainBritish Wrote: Thanks a bunch!

Glad I could help Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)