Topic: Noob Question - Running the BBCode Parser

Ok - I am showing the five most recent posts in my news forum on my frontpage.

I am able to get all of the news items and the related data, but the message is still original (hasn't been parsed out of BBCode).

So my question is - how can I parse the messages with the BBCode parser before they are displayed.

If '$message' is the message and my forum is installed in the '/forum' directory, what would be the code?

Thanks all!!!

Re: Noob Question - Running the BBCode Parser

include('forum/include/parser.php');

$message = parse_message($message, 0);

Re: Noob Question - Running the BBCode Parser

Thanks for the fast reply, but:

Fatal error: Call to undefined function: pun_htmlspecialchars() in /home/gamman/public_html/2142/forum/include/parser.php on line 383

Re: Noob Question - Running the BBCode Parser

Hrmm, better load functions.php too.

include('forum/include/parser.php');
include('forum/include/functions.php');

$message = parse_message($message, 0);

5 (edited by Gam-Man 2006-04-11 02:33)

Re: Noob Question - Running the BBCode Parser

Yep...that did the trick.

One thing though.  My BBCode urls are not being parsed. (They stay [url ]http://www.blah.com[/url ])

EDIT:  Found it - do_clickable(); - do_bbcode();

6 (edited by Gam-Man 2006-04-11 12:40)

Re: Noob Question - Running the BBCode Parser

Ok...I read the little blurb in the docs about integration.  Including the common.php file would be a lot easier saying that I may need access to other functions and variables later.

define('PUN_ROOT', './forum/');
require PUN_ROOT.'include/common.php';

But when I tried to include it, none of the functions registered.

Fatal error: Call to undefined function: parse_message() in /home/gamman/public_html/2142/includes/functions.php on line 24

parse_message() is the first function that I call on the page from the forum.

includes/functions.php is my functions file for my site.  I create the function to show threads there.

Re: Noob Question - Running the BBCode Parser

The parser isn't included in common.php, so you still have to do it seperately wink

Re: Noob Question - Running the BBCode Parser

love ya elbekko!!  Thanks!