MyBB Community Forums

Full Version: How do you parse BB Code from MyBB into your custom PHP pages?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently I'm building a CMS around the MyBB user database and so far I am able to retrieve the first posts of the news threads for a news page, I'll also be doing this with similar parts of the site but there's one thing I want to do for the news page is that I need to have BBCode.

I already know how to create my own BBCode parser and have done it in the past but I would rather use MyBB's so that it is intergrated more rather than having to rewrite a function that already exists.

So far I haven't found a way to parse an article. I'm moving across from vBulletin (despise it now) and using the vBulletin BBCode parser on other pages was very easy to do, all that was required was the following:

$do_html = false;
$do_smilies = false;
$do_bbcode = true;
$do_imgcode = true;
$do_nl2br = true;
$cachable = false;
						
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list('', true)); 
$post = $parser -> do_parse($article['article'], $do_html, $do_smilies, $do_bbcode, $do_imgcode, $do_nl2br, $cachable);
						
echo $post;

Is there something similar for MyBB? I've been searching around but so far can't seem to find anything about it.
see this thread. it should help
Thanks that worked great after a few tweaks.

The part where it says "no" and "yes" would not work however using TRUE and FALSE did. Also I had to assign a variable to the initial post contents first otherwise it would not parse. Other than that though it works other than one thing, smilies - for some reason it misses off the forumpath. Then again I'll be disabling those anyway but it would be nice to get them working just in case.