I actually have it working great but I want to add one small feature!! the replies/comments that are posted to it in the forum that I am pulling this from: the "full story" works fine and goes to the forum post. I was wondering if someone could help me add the replies to it: here is the code:
// ################### VB: PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array(
'userstats',
'birthdays',
'maxloggedin'
);
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### VB: REQUIRE BACK-END ############################
//chdir('upgrade/vb');
require_once('./global.php');
require_once('./includes/functions_bbcodeparse.php');
//require_once('./includes/functions_external.php'); // seems not to be needed here
chdir('..');
// ############################################################################
// Get Header template
$page_title = 'Welcome to Turcic.com!';
//include_once('./templates/header.php');
// ############################################################################
// connnect to custom database (not used so far)
// dbconnect();
// $result = dbquery("SELECT id, time, source, title, url, langid FROM links ORDER BY time DESC;") or die("MySQL Error: " . mysql_error());
// Here comes specific Page Content
?>
<?php
// set announcement forum id
global $index,$fontcolor1,$fontcolor2,$fontcolor3,$fontcolor4,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4, $title;
$announceforums = "14";
$forumchoice = array();
$forumids = explode(',', $announceforums);
foreach ($forumids AS $forumid)
{
$forumid = intval($forumid);
if (isset($forumcache["$forumid"]))
{
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice))
{
$forumchoice = 'AND thread.forumid IN(' . implode(',', $forumchoice) . ')';
}
else
{
$forumchoice = '';
}
// if unlogged, set us up as a very limited privileges user
if (!$bbuserinfo['userid'])
{
$vboptions['hourdiff'] = (date('Z', TIMENOW) / 3600 - intval($_REQUEST['timeoffset'])) * 3600;
$bbuserinfo = array('usergroupid' => 1);
$usergroupcache = array();
$permissions = cache_permissions($bbuserinfo);
}
// get visible forums for this user
$forumids = array();
foreach (array_keys($forumcache) AS $forumid)
{
$fp = &$bbuserinfo['forumpermissions']["$forumid"];
if ($fp & CANVIEW AND $fp & CANVIEWOTHERS)
{
$forumids[] = $forumid;
}
}
$previewfield = "post.pagetext AS preview,";
$previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)";
// query last 15 threads from visible / chosen forums
$threads = $DB_site->query("
SELECT $previewfield thread.threadid, thread.title, thread.lastposter, thread.lastpost, thread.postusername, thread.dateline, forum.forumid, forum.title AS forumtitle
FROM " . TABLE_PREFIX . "thread AS thread
$previewjoin INNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (deletionlog.primaryid = thread.threadid AND deletionlog.type = 'thread')
WHERE thread.forumid IN(" . implode(',', $forumids) . ") $forumchoice AND thread.visible = 1
AND deletionlog.primaryid IS NULL
ORDER BY thread.dateline DESC
LIMIT 5
");
$threadcache = array();
while ($thread = $DB_site->fetch_array($threads))
{ // fetch the threads
$threadcache[] = $thread;
}
if (!empty($threadcache))
{
foreach ($threadcache AS $thread)
{