Help johncms 500

200
.
How to add a category in the forum or on the front page of the index or the mainmenu page by using code
$req = mysql_query("SELECT `id`, `text`, `soft` FROM `forum` WHERE `type`='r' AND `refid`='$id' ORDER BY `realid`");
                $total = mysql_num_rows($req);
                if ($total) {
                    $i = 0;
                    while (($res = mysql_fetch_assoc($req)) !== false) {
                        echo $i % 2 ? '<div class="menu">' : '<div class="menu">';
                        $coltem = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' AND `refid` = '" . $res['id'] . "'"), 0);
                        echo '<a href="'.$home.'/forum/' . functions::gantiurl($res['text']) . '_'.$res['id'].'.html">' . $res['text'] . '</a>';
                        if ($coltem)
                            echo " [$coltem]";
                        if (!empty($res['soft']))
                            echo '<div class="sub"><span class="gray">' . $res['soft'] . '</span></div>';
                        echo '</div>';
                        ++$i;
                    }
                   echo '</div>';
                   unset($_SESSION['fsort_id']);
                    unset($_SESSION['fsort_users']);
                } else {
                    echo '<div class="menu"><p>' . $lng_forum['section_list_empty'] . '</p></div></div></div>';
                }
                }
.
egha, Do you speak Russian?
.
Let Mortal Kombat begin
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, '&#160;', '&#160;');
    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'] . '&amp;page=' . $cpg . '">&#160;&gt;&gt;</a>';
    }
    echo '<div class="sub">';
    echo $res['from'];
    if (!empty($nam['from'])) {
      echo '&#160;/&#160;' . $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
.
UA95, I'm sorry, did not notice
Всего: 4