Welcome Guest Search | Active Topics | Log In | Register

How to create a new bbcode Options · View
sinbad911
#1 Posted : Saturday, June 28, 2008 6:51:12 PM
Rank: Member


Joined: 11/20/2007
Posts: 24
Location: vn
how to create a new bbcode such as [audio][/audio] or [video][/video] to play a media file (*.mp3,*.wma, *.avi, *.wmv)
i want to post media file on my forum to view online, can u help meQuestion
Diễn đàn đại học Công Nghiệp TPHCM: http://congnghiep4.com
jhawley
#2 Posted : Tuesday, July 01, 2008 2:16:13 AM

Rank: YAF Forumling


Joined: 7/1/2008
Posts: 6
Location: Portland OR
The code to add a bbcode is the easy part.The hard part is knowing what the HTML code is that the bbcode translates into.

Do you know what the HTML is to add the file types your looking for? If so, post it here.
sinbad911
#3 Posted : Tuesday, July 01, 2008 3:19:46 AM
Rank: Member


Joined: 11/20/2007
Posts: 24
Location: vn
this code for mp3, wma files:
Quote:
<OBJECT id=Player
codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701
type=application/x-oleobject height=62 width=420
classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6>
<PARAM NAME="URL" VALUE="music.mp3">
</OBJECT>

this code for avi, wmv files:
Quote:
<OBJECT id=Player
codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701
type=application/x-oleobject height=420 width=420
classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6>
<PARAM NAME="URL" VALUE="music.avi">
</OBJECT>


width and height can optional (as [img][/img] tag)
Diễn đàn đại học Công Nghiệp TPHCM: http://congnghiep4.com
jhawley
#4 Posted : Tuesday, July 01, 2008 10:43:01 PM

Rank: YAF Forumling


Joined: 7/1/2008
Posts: 6
Location: Portland OR
Please note: I changed the tag names to [mp3wma] and [aviwmv] because there are a ton of video/audio formats, and this will probably not work for all of them(quicktime and realaudio come to mind).

You need to edit the bbcode.cs file, add the following code, recompile it, then copy the new binarys onto your web server.

This goes around line 84 (just before the line with "r_youtube" ) :
Code:
        static private Regex r_mp3wma = new Regex(@"\[mp3wma\](?<inner>(.*?))\[/mp3wma\]", m_options);
        static private Regex r_aviwmv = new Regex(@"\[aviwmv\](?<inner>(.*?))\[/aviwmv\]", m_options);


This goes around line 187 (just before "// youtube" ) :
Code:
                // mp3wma
                NestedReplace(ref bbcode, r_mp3wma, "<!-- BEGIN audio player --><OBJECT id=Player codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 type=application/x-oleobject height=62 width=420 classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6><PARAM NAME=\"URL\" VALUE=\"${inner}\"></OBJECT><!-- END audio player --><br />", new string[] { "inner" });
                // aviwmv
                NestedReplace(ref bbcode, r_aviwmv, "<!-- BEGIN video player --><OBJECT id=Player codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 type=application/x-oleobject height=420 width=420 classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6><PARAM NAME=\"URL\" VALUE=\"${inner}\"></OBJECT><!-- END video player --><br />", new string[] { "inner" });
jhawley
#5 Posted : Tuesday, July 01, 2008 11:24:15 PM

Rank: YAF Forumling


Joined: 7/1/2008
Posts: 6
Location: Portland OR
Oh one more thing.. when using these, it would be best to provide a full url to the file, not just the filename like the one you listed in the sample code.

something like:
Code:
[mp3wma]http://www.somewebserver.com/media/music.mp3[/mp3wma]
trigun
#6 Posted : Friday, July 25, 2008 12:38:38 AM

Rank: YAF Forumling


Joined: 7/16/2008
Posts: 8
Location: Manila
Hi,

I can't open the solution/project in Visual Studio 2005. Is there a particular version that I should use to recompile the project for the newly added bbcodes?

One more thing is that how can I display the [BB/] icon beside the other tools? In my forum, I can use the tags [youtube] [/youtube] to embed youtube videos on posts but I type it manually because the [BB/] button is not visible.

www.itchytech.com


Please help.

Thanks in advance....
Jaben
#7 Posted : Friday, July 25, 2008 1:07:32 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 2,963
Location: Honolulu, HI
All these features are in the new version of YAF.
"When you are grateful, fear disappears and abundance appears”."

continienzo
#8 Posted : Friday, July 25, 2008 1:55:37 PM
Rank: Advanced Member


Joined: 1/23/2008
Posts: 70
Location: Italy
Jaben wrote:
All these features are in the new version of YAF.


I still can't see the [bb/] button in the 1.9.3 beta released... Even if I update the forum with the repository version Sad
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.131 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET