guest
2007-05-01T13:17:17Z
Is there anyway to embed YouTube videos in posts?
Sponsor
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2007-05-01T18:22:49Z
Could be added pretty easily. Are you using version 1.9.0?
guest
2007-05-01T19:28:37Z
Yes I am. Can you show me how to do it or what files need to be modified?

Cheers!
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2007-05-03T03:20:53Z
YouTube (BBCode) addition to YAF.

In BBCode.cs, after this line (82):

static private Regex r_img = new Regex( @"\[img\](?<http>(http://)|(https://)|(ftp://)|(ftps://))?(?<inner>(.*?))\[/img\]", m_options );

Add this line:

static private Regex r_youtube = new Regex( @"\[youtube\](?<inner>http://(www\.)?youtube.com/watch\?v=(?<id>[0-9A-Za-z-_]{11})[^[]*)\[/youtube\]", m_options);

In the same file, line (181) after this:

// image
NestedReplace( ref bbcode, r_img, "<img src=\"${http}${inner}\"/>", new string [] { "http" }, new string [] { "http://" } );

add these lines:

// youtube
NestedReplace( ref bbcode, r_youtube, @"<!-- BEGIN youtube --><object width=""425"" height=""350""><param name=""movie"" value=""http://www.youtube.com/v/${id}""></param><embed src=""http://www.youtube.com/v/${id}"" type=""application/x-shockwave-flash"" width=""425"" height=""350""></embed></object><br /><a href=""http://youtube.com/watch?v=${id}"" target=""_blank"">${inner}</a><br /><!-- END youtube -->", new string [] { "id" } );

Recompile.

The new tags can be used by putting the "Watch" link between [youtube] tags, e.g.:


[youtube]http://youtube.com/watch?v=0_nOVtjTFiA[/youtube]

Enjoy!
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2007-05-03T03:28:50Z
I updated this forum with the code... Here's an example:







test2005
2007-05-03T04:42:43Z

....we're not worthy....we're not worthy....

I couldn't add this one fast enough!!!!!!!!!!!!

:P
.....the man in black fled across the desert..........and the gunslinger followed.....
Mek
  •  Mek
  • 100% (Exalted)
  • YAF Developer
2007-05-03T08:27:50Z
lol couldn't you have chosen something a little more uhm interesting as an example.. something with Chuck Norris maybe?

Edit:






ok couldn't resist...........
UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
guest
2007-05-04T13:56:33Z
Holy crap that was FAST!!!

Thanks Mek you are my hero! 😃
guest
2007-05-04T14:57:25Z
Hey Mek is there a simple way to add a YouTube button to the default editor?




Dr-Hack
2007-05-05T07:32:21Z
Good Jaben:) .. i'll need to re install my VS [:)]
Mek
  •  Mek
  • 100% (Exalted)
  • YAF Developer
2007-05-05T12:10:52Z
Bloody hell Dr-Hack's back, where the hell you been? :-)

and

Quote:

Thanks Mek you are my hero!


I hope thats just because of my Chuck post, Jaben did all the work for this and I don't take credit for other people's work.....

The implementation for the default editor is a described above, if your not a programmer/ don't have access to the code I'm sure one of us can modify the files for you, but it won't be straight away.............

,Mek.

UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
guest
2007-05-06T07:06:20Z
haha ooops I was so excited that I overlooked who posted the fix (thanks for pointing that out for me Mek)!

Jaben you are me hero!!!

I'm a novice VB programmer but but I'll take a whack at the default editor code!

Cheers
redLine
2007-05-11T06:46:44Z
Jaben wrote:


Recompile.



i can't recompile because i havn't got vs.net :S
trueman
2007-05-14T03:33:03Z




test2005
2007-05-17T04:49:24Z
redLine wrote:

Jaben wrote:


Recompile.



i can't recompile because i havn't got vs.net :S



You can download VS Express in VB, C# and J# flavours for free at the microsoft sight!! Might as well download SQL Express and the Management Studio. You'll need those to work with the data file.


.....the man in black fled across the desert..........and the gunslinger followed.....

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved