
01-29-2005, 07:27 AM
|
 |
|
|
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by TECK
Here it is a basic example:
Code:
$forumperms = array();
foreach ($forumcache AS $forum)
{
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
if (!($forumperms["$forum[forumid]"] and CANVIEW) or !($forumperms["$forum[forumid]"] and CANVIEWOTHERS))
{
$limitfids .= ',' . $forum['forumid'];
}
}
$getthreads = $DB_site->query("
SELECT thread.title, thread.date, thread.time, thread.replycount
FROM " . TABLE_PREFIX . "thread AS thread
WHERE open = '1'
AND thread.lastpost >= " . (time() - 86400) . "
AND forumid NOT IN (0$limitfids)
AND thread.visible = '1'
ORDER BY lastpost DESC
LIMIT 5
");
while ($thread = $DB_site->fetch_array($getthreads))
{
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspecialchars($thread['title']), 68));
$thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
$thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
$thread['replycount'] = vb_number_format($thread['replycount']);
eval('$threadbits .= "' . fetch_template('myowntemplate_latestthreadbit') . '";');
}
unset($forum, $thread, $threads);
$DB_site->free_result($getthreads);
|
A typo in red ?
Quote:
Originally Posted by TECK
Code:
$forumperms = array();
foreach ($forumcache AS $forum)
{
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
if (!($forumperms["$forum[forumid]"] and CANVIEW) or !($forumperms["$forum[forumid]"] and CANVIEWOTHERS))
{
$limitfids .= ',' . $forum['forumid'];
}
}
$getthreads = $DB_site->query("
SELECT thread.title, thread.date, thread.time, thread.replycount, f.title as forumtitle
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "forum as f
ON f.forumid = thread.forumid
WHERE thread.open = '1'
AND thread.lastpost >= " . (time() - 86400) . "
AND thread.forumid NOT IN ($limitfids)
AND thread.visible = '1'
ORDER BY thread.lastpost DESC
LIMIT 5
");
while ($thread = $DB_site->fetch_array($getthreads))
{
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspecialchars($thread['title']), 68));
$thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
$thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
$thread['replycount'] = vb_number_format($thread['replycount']);
$forumname = $thread['forumtitle'];
eval('$threadbits .= "' . fetch_template('myowntemplate_latestthreadbit') . '";');
}
unset($forum, $thread, $threads);
$DB_site->free_result($getthreads);
|
Adding on to TECK's code, this should give you the forum of that particular thread as well. ( use $forumname in your template ).
Changes in red bold
Hope that helps.
|