Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved myBB Parser help / Integration help
#1
Not Solved
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.
Reply
#2
Not Solved
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.
[Image: axolis.png]

Project, Portfolio and Product management for freelancers.
Reply
#3
Not Solved
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'
);
Reply
#4
Not Solved
Where is the $forum array defined? It should contain a bunch of booleans. Is "allowmycode" set to true?

Edit: haven't noticed your edit.
[Image: axolis.png]

Project, Portfolio and Product management for freelancers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)