vBulletin BBCode on external page
I integrated my vBulletin with custom front page. I'm wondering, how could I use vBulletin BBcode on tha开发者_运维知识库t page (I'm displaying some posts there).
Any suggestions?
It's probably best to just use the BBCode parser from vBulletin itself. It's relatively easy to use, here's an example:
require_once('global.php');
require_once('includes/class_bbcode.php');
$parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$text = $parser->parse('[B][I]text[/I][/B]');
print $text;
You may need to play games with chdir
to include global.php
from somewhere outside the vBulletin tree, but I'm sure you've had to do that for other integration anyway. :)
There are way of restricting the tags too, just have a rummage around class_bbcode.php
and you'll see some fairly obvious places to start.
精彩评论