Extra BBcode

Forum
Last Post
Threads / Messages

AlexC

Moderator
Moderator
Joined
Dec 17, 2009
Messages
742
Points
0
Age
28
Location
Canada
Mysidian Dollar
43,036
I am not sure if this counts as a mod or not, feel free to move if need be.

Go to your INC folder and then find the bbcode.php file.

There is a chunk of code starting with // PARSE BB CODE - go to the bottom of this chunk, above // RETURN HTML RESULT and put whatever ones of the following you want.

Headers

Code:
$text = preg_replace('|\[h1\](.+?)\[\/h1\]|i', '<center><font size="+3" color="#000000">$1</font></center>', $text);
        $text = preg_replace('|\[h2\](.+?)\[\/h2\]|i', '<center><font size="+2" color="#000000">$1</font></center>', $text);
        $text = preg_replace('|\[h3\](.+?)\[\/h3\]|i', '<center><font size="+1" color="#000000">$1</font></center>', $text);
        $text = preg_replace('|\[h4\](.+?)\[\/h4\]|i', '<font size="+3" color="#000000">$1</font>', $text);
        $text = preg_replace('|\[h5\](.+?)\[\/h5\]|i', '<font size="+2" color="#000000">$1</font>', $text);
        $text = preg_replace('|\[h6\](.+?)\[\/h6\]|i', '<font size="+1" color="#000000">$1</font>', $text);

Change the font color to whatever you'd like to have the headers as. The first three are centered, and the last three are the same sizes, but not centered.

Anchor

This is a code for creating an anchor in a page. (example - faq.php#Adoptable Questions)

http://www.w3schools.com/HTML/html_links.asp - more info on anchors here.

Code:
 $text = preg_replace('|\[anchor=(.+?)\](.+?)\[\/anchor\]|i', '<a name="$1">$2</a> ', $text);

<br>

I added this one because when I was using tables, I wanted to have them on seperate lines.

Code:
 $text = preg_replace('|\[br\]|i', '<br>', $text);

I use two <br> tags because I prefer to have my lists with gaps.

Tables

Thank you to fadillzzz for showing me how to do this one.

Code:
        $text = preg_replace('|\[table\](.+?)\[\/table\]|i', '<table>$1</table>', $text);
        $text = preg_replace('|\[th\](.+?)\[\/th\]|i', '<th>$1</th>', $text);
        $text = preg_replace('|\[tr\](.+?)\[\/tr\]|i', '<tr valign="top">$1</tr>', $text);
        $text = preg_replace('|\[td\](.+?)\[\/td\]|i', '<td>$1</td>', $text);

OR

Tables with borders.

Code:
$text = preg_replace('|\[table2\](.+?)\[\/table2\]|i', '<table border="2" cellpadding="2" cellspacing="2">$1</table>', $text);

You can customize the borders however you like. The way they are now is how your tables will be by default in the script.

That's all I've got for now, I will include more later. I'm working on a few of my own custom ones as well.

ALSO: While we're on the subject - I use this code as well, it's not mine however; http://www.mysidiaadoptables.com/forum/showthread.php?t=1908 Just thought I'd include it.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,048
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top