Current time: 09-09-2010, 07:35 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] 7 Custom MyCodes for your forum
05-12-2009, 03:58 AM (This post was last modified: 05-17-2009 04:43 PM by Nunymare.)
Post: #1
[Tutorial] 7 Custom MyCodes for your forum
You can view working examples at this thread, on my forum.

7 Custom MyCodes for your Forum

Hey guys, me again, and this time I'm here to show you how to add a couple new custom Mycodes to your forum.

Ones I'll teach you to add will be:
  • Marquee Text
  • Hilighted Text
  • Module
  • Fieldset
  • Custom Spacing in between text
  • Small Capitals Text
  • Image Text Background

--------------

1. Marquee

Regular expression:
Code:
\[marquee\](.*?)\[/marquee\]

Replacement:
Code:
<marquee>$1</marquee>

2. Hilighted Text
*Users will have to specify a hex code for the hilight color desired

Regular expression:
Code:
\[hilight color=(.*?)\](.*?)\[/hilight\]

Replacement:
Code:
<span style="background-color:#$1;">$2</span>

3. Module
*This will create a 'module', following your forum theme.


Regular expression:
Code:
\[module title=(.*?)\](.*?)\[/module\]

Replacement:
Code:
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr><td class="thead"><strong>$1</strong></td></tr>
<tr><td class="trow1">
$2
</td></tr>
</table>

4. Fieldset

Regular Expression:
Code:
\[fieldset title=(.*?)\](.*?)\[/fieldset\]

Replacement:
Code:
<fieldset class="bbfieldset"><legend class="bblegend"><span style="color:#2222ac;">$1</span></legend>$2</fieldset>

5. Custom spacing in between text

Regular expression:
Code:
\[spacing pixels=(.*?)\](.*?)\[/spacing\]

Replacement:
Code:
<span style="letter-spacing:$1px;">$2</span>

6. Small Capital Letters Text

Regular Expression:
Code:
\[smallcaps\](.*?)\[/smallcaps\]

Replacement:
Code:
<span style="font-variant:small-caps;" >$1</span>

7. Image Text Background

Regular Expression:
Code:
\[textbg img=(.*?)\](.*?)\[/textbg\]

Replacement:
Code:
<span style="background-image:url('$1')" >$2</span>

----------
Usage:

Marquee:
Code:
[marquee]Text[/marquee]

[b]Hilighted Text:[/b]

[code][hilight color=Color Hex Code]Text[/hilight]

Module:

Code:
[module title=Title for your module]Content here[/module]

Fieldset:

Code:
[fieldset title=Title for your fieldset]Content here[/fieldset]

Custom spacing in between text:

Code:
[spacing pixels=Pixels you want in between letters]Text[/spacing]

[b]Small Capital Letters Text:[/b]

[code][smallcaps]Text[/smallcaps]

Image Text Background (hilighted text, just with a bg image)

Code:
[textbg img=URL TO YOUR IMAGE]Text Here.[/textbg]

You can view working examples at this thread, on my forum.

Thank you.
Find all posts by this user
Quote this message in a reply
05-12-2009, 05:50 AM
Post: #2
RE: [Tutorial] 7 Custom MyCodes for yourr forum
Great Job! I might use some of these!

Joshua Mayer
Ex-MyBB Support Team
Find all posts by this user
Quote this message in a reply
05-12-2009, 11:23 AM
Post: #3
RE: [Tutorial] 7 Custom MyCodes for yourr forum
I've seen a number of MyCodes where "(.*?)" expression is used. I thought it'd be about time that I suggest trying to avoid that expression where possible, as this may allow users to perform some minor HTML injection (HTML tags are automatically converted to their entities and Javascript is automatically stripped out, so luckily this isn't that big an issue).

Suggestions:
Number fields, use "([0-9]+)"
General CSS fields (may not apply to everything), use "([0-9a-zA-Z\-_ ]+)"

Hope that helps.

If you wish to contact me, you can do so at MyBB Hacks.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-12-2009, 10:34 PM
Post: #4
RE: [Tutorial] 7 Custom MyCodes for yourr forum
Anyone try this yet?
Find all posts by this user
Quote this message in a reply
05-14-2009, 08:20 AM
Post: #5
RE: [Tutorial] 7 Custom MyCodes for yourr forum
all of these is bad
and doesn't work

\[marquee\](.*?)\[/marquee\]

must be
\[marquee\](*.?)\[/marquee\]

and alot of bugs
but extra good thing for a n00b oo sorry for newbie Wink
you must learn "regulair expression" befor
Best Regards

http://www.safadsoft.com
1.4.4
Visit this user's website Find all posts by this user
Quote this message in a reply
05-14-2009, 01:16 PM
Post: #6
RE: [Tutorial] 7 Custom MyCodes for yourr forum
Excuse me, they DO work, if you've checked my forum.

I just copy pasted the codes, simply.
Find all posts by this user
Quote this message in a reply
05-17-2009, 04:43 PM
Post: #7
RE: [Tutorial] 7 Custom MyCodes for yourr forum
(05-14-2009 08:20 AM)SAFAD Wrote:  all of these is bad
and doesn't work

\[marquee\](.*?)\[/marquee\]

must be
\[marquee\](*.?)\[/marquee\]

and alot of bugs
but extra good thing for a n00b oo sorry for newbie Wink
you must learn "regulair expression" befor
Best Regards

What bugs? Come on man.
Find all posts by this user
Quote this message in a reply
05-17-2009, 05:12 PM (This post was last modified: 05-17-2009 05:13 PM by aglioeolio.)
Post: #8
RE: [Tutorial] 7 Custom MyCodes for yourr forum
Thanks for this Tut, nunymare, it´s very usefull



(05-12-2009 11:23 AM)Yumi Wrote:  I've seen a number of MyCodes where "(.*?)" expression is used. I thought it'd be about time that I suggest trying to avoid that expression where possible, as this may allow users to perform some minor HTML injection (HTML tags are automatically converted to their entities and Javascript is automatically stripped out, so luckily this isn't that big an issue).

Suggestions:
Number fields, use "([0-9]+)"
General CSS fields (may not apply to everything), use "([0-9a-zA-Z\-_ ]+)"

Hope that helps.

Thanks for the Tip Yumi Smile

I´ve got some mycode and they all still used (.*?)

[]s, Claudio

Tutorial: Jquery (by google API) with mybb (Prototype)
Distinction between Paid/Free Plugins Threads
Visit this user's website Find all posts by this user
Quote this message in a reply
05-26-2009, 04:45 AM
Post: #9
RE: [Tutorial] 7 Custom MyCodes for your forum
Thanks!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


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