JayC
Always Learning
I need 2 things regarding BB code and I am not really sure how it works.
1) BB Code -> HTML Code
Still Returns BB Code
2) BB Code Toolbar
I've been trying for a couple hours, and can't get either of these to work...
Thanks Guys![Smile :) :)](/styles/default/xenforo/smilies/emojione/smile.png)
1) BB Code -> HTML Code
PHP:
public static function BBcode($text)
{
$bbcode = array("<", ">",
"[list]", "[*]", "[/list]",
"[img]", "[/img]",
"[b]", "[/b]",
"[u]", "[/u]",
"[i]", "[/i]",
'[color="', "[/color]",
"[size=\"", "[/size]",
'[url="', "[/url]",
"[mail=\"", "[/mail]",
"[code]", "[/code]",
"[quote]", "[/quote]",
'"]');
$htmlcode = array("<", ">",
"<ul>", "<li>", "</ul>",
"<img src=\"", "\">",
"<b>", "</b>",
"<u>", "</u>",
"<i>", "</i>",
"<span style=\"color:", "</span>",
"<span style=\"font-size:", "</span>",
'<a href="', "</a>",
"<a href=\"mailto:", "</a>",
"<code>", "</code>",
"<table width=100% bgcolor=lightgray><tr><td bgcolor=white>", "</td></tr></table>",
'">');
$newtext = str_replace($bbcode, $htmlcode, $text);
$newtext = nl2br($newtext);//second pass
return $newtext;
}
![Fwu3ZBX.png](/proxy.php?image=http%3A%2F%2Fi.imgur.com%2FFwu3ZBX.png&hash=b2ada2ba170ff3edf8bf97360d7c759a)
2) BB Code Toolbar
![1cUd4CB.png](/proxy.php?image=http%3A%2F%2Fi.imgur.com%2F1cUd4CB.png&hash=0aeb94430e33475b1cee5b8a22ad1053)
I've been trying for a couple hours, and can't get either of these to work...
Thanks Guys
![Smile :) :)](/styles/default/xenforo/smilies/emojione/smile.png)