You do not need this code.
if you need to display only one category it is better to use statics (html) i.e.
<a href="forum/index.php?id=ForumId">ForumName</a>
If you want to display topics of the concrete forum:
$id = 2; // id of the forum
$limit = 10 // number of topics on mainpage
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='t' AND `refid`='$id'" . ($rights >= 7 ? '' : " AND `close`!='1'")), 0);
if ($total) {
$req = mysql_query("SELECT * FROM `forum` WHERE `type`='t'" . ($rights >= 7 ? '' : " AND `close`!='1'") . " AND `refid`='$id' ORDER BY `vip` DESC, `time` DESC LIMIT $limit");
$i = 0;
while (($res = mysql_fetch_assoc($req)) !== false) {
if ($res['close'])
echo '<div class="rmenu">';
else
echo $i % 2 ? '<div class="list2">' : '<div class="list1">';
$nikuser = mysql_query("SELECT `from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $res['id'] . "' ORDER BY `time` DESC LIMIT 1");
$nam = mysql_fetch_assoc($nikuser);
$colmes = mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `refid`='" . $res['id'] . "'" . ($rights >= 7 ? '' : " AND `close` != '1'"));
$colmes1 = mysql_result($colmes, 0);
$cpg = ceil($colmes1 / $kmess);
$np = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_rdm` WHERE `time` >= '" . $res['time'] . "' AND `topic_id` = '" . $res['id'] . "' AND `user_id`='$user_id'"), 0);
// Значки
$icons = array(
($np ? (!$res['vip'] ? '<img src="theme/' . $set_user['skin'] . '/images/op.gif" alt=""/>' : '') : '<img src="theme/' . $set_user['skin'] . '/images/np.gif" alt=""/>'),
($res['vip'] ? '<img src="theme/' . $set_user['skin'] . '/images/pt.gif" alt=""/>' : ''),
($res['realid'] ? '<img src="theme/' . $set_user['skin'] . '/images/rate.gif" alt=""/>' : ''),
($res['edit'] ? '<img src="theme/' . $set_user['skin'] . '/images/tz.gif" alt=""/>' : '')
);
echo functions::display_menu($icons, ' ', ' ');
echo '<a href="forum/index.php?id=' . $res['id'] . '">' . $res['text'] . '</a> [' . $colmes1 . ']';
if ($cpg > 1) {
echo '<a href="forum/index.php?id=' . $res['id'] . '&page=' . $cpg . '"> >></a>';
}
echo '<div class="sub">';
echo $res['from'];
if (!empty($nam['from'])) {
echo ' / ' . $nam['from'];
}
echo ' <span class="gray">(' . functions::display_date($res['time']) . ')</span></div></div>';
++$i;
}
} else {
echo '<div class="menu"><p>' . $lng_forum['topic_list_empty'] . '</p></div>';
}insert this code into pages/mainmenu.php