Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making your own codes!
Author Message
ms365 Offline
MybbSource Skinner
***

Posts: 95
Joined: Dec 2009
Reputation: 1
Post: #1
Question Making your own codes!
With MyCodes, you can create your own bbcodes.Some pre-added bbcodes in Mybb are:
-Bold
-Italicize
-Underline

To make your own bbcodes, you should have some knowledge of HTML.
How it works:
Converts the bbcodes(which users enter in their post) into HTML which is executed and shown to the user's browser.
It tells the user's browser that [ b ] means <b> and hence, [ b ] is converted to <b>

How to create my own MyCode?
1)Go on your Forum
2)Log-on to Admin Control Panel
3)Click on the "Configuration" tab
4)Then click on "MyCode"
5)You will see here the lists of MyCode you have made.But now, there will be none! Because you haven't created any!
So click on "Add new MyCode"
6)You will see a page where it will ask for the following things:
Title The name of the code you are gonna make
Short Description A short description about what your code will do
Regular Expression Users will enter this in their posts
Replacement The conversion of "Regular Expression/BBCODE(USER WILL ENTER)" to HTML.
Enabled Can the users use this code?
Parse order The order at which your code will be in the MyCodes list.
7)So we will be creating a code which will allow the users to chose the direction of the text! (I have already added this mycode in the mycodes section)Though, I have made a bit tough codes which I do not want to post here, so we will go with this one.
Title Type "Text Direction"
Short Description Type "Allows user to select the direction of the text"
Regular Expression Ok.So here is the major part of making your code.
This is what users will enter.
In the bold code, this would be entered here:
\[ b \](.*?)\[ /b \]
-Before every square bracket, you must but a "\"(without quotes).
-(.*?) is a variable.Now this means that a user will enter something here.
So the user in his post will enter:
[ b ]Any text [ /b ]
And the result will be this:
Any text
---Text Direction Regular Expression
Now this is the Regular expression for our Text direction code.Type this:
\[direction=(.*?)\](.*?)\[/direction\]
As you can clearly see, I have put a slash before every square bracket.And the first (.*?) (After the "=" ) will allow the user to select the direction of the text.And the second (.*?) (Between the direction tags) will be the text the user will input.
So the code user will enter is( do not enter this code in the Regular Expressions):
[direction=THEDIRECTION]THE TEXT[/direction]

Replacement
The Replacement code is always in HTML.So the Replacement will be this:
<bdo dir=$1>$2</bdo>
The "bdo" tag , in html is used for the same purpose we are making the MyCode for i.e it will allow the user to select the direction in HTML.And "bdo" tag's attribute is "dir" which is where the direction is selected.There can be two values here: rtl(right to left) and ltr(left to right).
Now see "$1" is the replacement of (.*?).$ means that this is a variable.And the number after it is the order of the (.*?).
So $1 is referred as \[direction=(.*?)\](.*?)\[/direction\](The bold text) here.And $2 is referred as \[direction=(.*?)\](.*?)\[/direction\] here.As you add variables in the Regular Expressions, you have to define them in Replacement too.Here, I've defined both the (.*?) as $1 and $2.If you create more (.*?), there will be more Replacement variables like $3, $4 written at its respective place.
Enabled Select Yes.
Parse order Type 1 if you haven't made any other MyCode.
Tada! Your MyCode is ready!
If you have any other questions, just ask me!
(This post was last modified: 04-22-2010, 04:54 AM by ms365)
04-22-2010, 04:54 AM
Find all posts by this user Quote this message in a reply
Conor Calby Offline
Posting Freak
*****

Posts: 946
Joined: Jan 2010
Reputation: 15
Post: #2
RE: Making your own codes!
Thanks for the great share Big Grin

MyBBSource Support Team Member - MyBBSource Tutorials Team Leader
Official MyBB Support Tech
If I helped, why not rep me 001_smile
04-22-2010, 05:00 AM
Visit this user's website Find all posts by this user Quote this message in a reply
groovybluedog Offline
Member
***

Posts: 148
Joined: Feb 2010
Reputation: 0
Post: #3
RE: Making your own codes!
Even after this tutorial and tonnes of help on Mybb.com, I still fail to get it. I can see the purpose, But doing it confuses me.
05-31-2010, 02:03 AM
Find all posts by this user Quote this message in a reply
ms365 Offline
MybbSource Skinner
***

Posts: 95
Joined: Dec 2009
Reputation: 1
Post: #4
RE: Making your own codes!
What's wrong? What can't you understand? Wink
06-02-2010, 12:20 AM
Find all posts by this user Quote this message in a reply
Don+ Offline
Member
***

Posts: 68
Joined: Aug 2010
Reputation: 0
Post: #5
RE: Making your own codes!
Bookmarked, Big Grin I always love such tut.
08-21-2010, 10:19 AM
Find all posts by this user Quote this message in a reply
ms365 Offline
MybbSource Skinner
***

Posts: 95
Joined: Dec 2009
Reputation: 1
Post: #6
RE: Making your own codes!
^^Ah, Cool Wink
And I wrote some wrong information LOL in my tut.It happens like this:
BBcodes in Users Posts are first converted by the server then executed and then shown to Browser 001_tt2
Any moderator can correct it Wink
08-21-2010, 10:49 AM
Find all posts by this user Quote this message in a reply
flipflops Offline
Junior Member
**

Posts: 5
Joined: Dec 2010
Reputation: 0
Post: #7
RE: Making your own codes!
It is very easy to write your own Html codes.There are many Html website available .
(This post was last modified: 12-04-2010, 02:42 PM by flipflops)
12-03-2010, 10:29 PM
Find all posts by this user Quote this message in a reply
flamehosts Offline
Member
***

Posts: 152
Joined: Oct 2010
Reputation: 1
Post: #8
RE: Making your own codes!
nice tut i will see if i can make my own codes using it
12-05-2010, 01:49 AM
Find all posts by this user Quote this message in a reply
ms365 Offline
MybbSource Skinner
***

Posts: 95
Joined: Dec 2009
Reputation: 1
Post: #9
RE: Making your own codes!
^^^
Sure, dont forget it to add it in the MyCodes list, ok ? ;p
12-05-2010, 04:52 AM
Find all posts by this user Quote this message in a reply
iamthehero Offline
Junior Member
**

Posts: 11
Joined: Dec 2010
Reputation: 0
Post: #10
RE: Making your own codes!
its a very good tut Big Grin
12-05-2010, 05:20 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)