MyBB Community Forums

Full Version: myBB Parser help / Integration help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I am trying to make a Website where in the Homepage it displays the Messages from the News Board in the Forums which I achieved but now I am having problems with the bbcode parser. Since in the homepage this is what is being displayed:

[Image: 7YFkead.png]

Since my Forum is installed in the /forum/ Directory I tried doing this:

require_once 'forum/inc/class_parser.php'; // requires the MyBBIntegrator class

$parser_options = array(
                "allow_html" => $forum['allowhtml'],
                "allow_mycode" => $forum['allowmycode'],
                "allow_smilies" => $forum['allowsmilies'],
                "allow_imgcode" => $forum['allowimgcode'],
                "allow_videocode" => $forum['allowvideocode'],
                "filter_badwords" => 1
$parser = new postParser;

And then to display, I tried this:

$message = '[b]Hello, how are you?[/b]';
$parser->parse_message($message, $parser_options);

But once I did it, this is the Error I get:
Notice: Trying to get property of non-object in C:\xampp\htdocs\website\forum\inc\class_parser.php on line 103

I hope you can help me.
You will have to include forum/global.php because the $mybb variable is not defined. You can't use the parser without that being defined.
Oh yes, I required global.php and then it gave me the error of:

Direct initialization of this file is not allowed.
Please make sure IN_MYBB is defined.

so I defined "IN_MYBB" and added this code before the the require_once code of global.php
define("IN_MYBB", 1);

And this is what I get as the Result:
[Image: XlKOBqd.png]

Oh wait, never mind.. now the Error was in the $post_options

Added this later:
$parser_options = array(
    'allow_html' => 'no',
    'allow_mycode' => 'yes',
    'allow_smilies' => 'yes',
    'allow_imgcode' => 'yes',
    'filter_badwords' => 'yes',
    'nl2br' => 'yes'
Where is the $forum array defined? It should contain a bunch of booleans. Is "allowmycode" set to true?

Edit: haven't noticed your edit.