PDA

View Full Version : Retrieving a post on external page


Riotblade
03-22-2009, 05:28 PM
Hi, I'm trying to mimic the SMF function SSI_BoardNews() with my own version of SSI.php for Vbulletin. However, I can't seem to find the BBC parsing function for VB. Does anyone know the name of the function, and the include file it's under? Also, the way I'm retrieving the post right now is unconventional. Is there any way to retrieve posts without directly fetching them with queries?

Thanks

Cryo
03-22-2009, 06:08 PM
You'll want to have the following included in your page...

// Include vBulletin Addons
chdir("/path/to/forums/forums"); // <-- Change This
include("./global.php");
require_once('./includes/class_bbcode.php');If you need to switch back to the CWD before the CHDIR, simply set a variable to getcwd() and then after you have included both files chdir() to that var.

To parse the post, the following code will be needed...

$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());

$parser->do_parse($var, 0, 1, 1, 1, 1, 0);$var contains the content you want to parse. The set of numbers after $var are flags for the following...

do_parse (string $text, [bool $do_html = false], [bool $do_smilies = true], [bool $do_bbcode = true], [bool $do_imgcode = true], [bool $do_nl2br = true], [bool $cachable = false])

Riotblade
03-23-2009, 12:17 AM
Thanks, works wonderfully.

My next question would be how to retrieve the cached stats that is shown in FORUMHOME?

It retrieves it through:


$vbphrase[threads]: $totalthreads,
$vbphrase[posts]: $totalposts,
$vbphrase[members]: $numbermembers


I do not know how the template system works or what files it includes. I do not want to query it everytime if a cached value exists somewhere.

Thanks

Dismounted
03-23-2009, 10:11 AM
Those stats are fetched from the vBulletin datastore. I believe that there is an article floating around about it. :)