MyBB Community Forums

Full Version: Parsing mybb code on site
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I parse the mybb code on my website (not forums). I am displaying threads on my website, so instead of the [ img ] I need it to be the <img src=""

HEY GUYS FIGURED IT OUT with a little bit of cool tricks. Feel free to use this thread!

Here is my fix

require("forums/inc/class_parser.php"); // path to your class_parser.php

// the well known IN_MYBB for public pages
define("IN_MYBB", 1);

// If you don't want visits here showing up on the Who's Online
define("NO_ONLINE", 1);

// if you don't need plugins in your page
define("NO_PLUGINS"); 


	$parser = new postParser;

	$parser_options = array(
"allow_html" => "1",               // or "yes"
"allow_mycode" =>"1",
"allow_smilies" => "1",
"allow_imgcode" => "1",
"nl2br"=>"1",
"filter_badwords" => 1,
"shorten_urls" =>"1",
"me_username" => "0");

	$replytext = $parser->parse_message($message, $parser_options); 
// $message is the text that you want to parse
// $replytext is the parsed text


// $username is the username of the user who made the post 
$username posted</b><br><br>
$replytext

";	
	
}