как сделать вывод разделов форума на главную? john 4.4
Tobi (02.07.2012/14:48)
как сделать вывод разделов форума на главную? john 4.4
я делал так ))в манейм \
<?
/*
////////////////////////////////////////////////////////////////////////////////
// JohnCMS Mobile Content Management System //
// Project site: http://johncms.com //
// Support site: http://gazenwagen.com //
////////////////////////////////////////////////////////////////////////////////
// Lead Developer: Oleg Kasyanov (AlkatraZ) alkatraz@gazenwagen.com //
// Development Team: Eugene Ryabinin (john77) john77@gazenwagen.com //
// Dmitry Liseenko (FlySelf) flyself@johncms.com //
////////////////////////////////////////////////////////////////////////////////
*/
defined('_IN_JOHNCMS') or die('Error: restricted access');
$mp = new mainpage();
$lng_forum = core::load_lng('forum');
if ($id) {
} else {
/*
-----------------------------------------------------------------
Ограничиваем доступ к Форуму
-----------------------------------------------------------------
*/
$error = '';
if (!$set['mod_forum'] && $rights < 7)
$error = $lng_forum['forum_closed'];
elseif ($set['mod_forum'] == 1 && !$user_id)
$error = $lng['access_guest_forbidden'];
if ($error) {
echo '<div class="rmenu"><p>' . $error . '</p></div>';
}
$headmod = $id ? 'forum,' . $id : 'forum';
/*
-----------------------------------------------------------------
Список Категорий форума
-----------------------------------------------------------------
*/
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_files`" . ($rights >= 7 ? '' : " WHERE `del` != '1'")), 0);
///////////
///////////////Новости/////////////////
echo '<div class="phdr"><b>' . $lng['information'] . '</b></div>';
$mp = new mainpage();
echo $mp->news;
/////////////////////////////////////////
//echo '<div class="topmenu"><b>Мы работаем с каждым человеком!</b></div>';
///////////////
echo '<div class="gmenu"><a href="news/index.php">' . $lng['news_archive'] . '</a> (' . $mp->newscount . ')<br/><a href="pages/faq.php">FAQ</a> | <a href="users/index.php?act=userlist">' . $lng['users'] . '</a> | <a href="users/album.php">' . $lng['photo_albums'] . '</a> (' . counters::album() . ')<br/><a href="../pages/faq.php?act=forum">' . $lng_forum['forum_rules'] . '</a> | <a href="forum/search.php">' . $lng['search'] . '</a> | <a href="forum/index.php?act=files">' . $lng_forum['files_forum'] . '</a> <span class="red">(' . $count . ')</span><br/><a href="users/index.php?act=admlist">' . $lng['administration'] . '</a> | <a href="guestbook/index.php">' . $lng['guestbook'] . '</a> (' . counters::guestbook() . ')</div>';
/////////
echo '<div class="topmenu"><b>' . counters::forum_new(1) . '</b></div>';
/////////
$req = mysql_query("SELECT `id`, `text`, `soft` FROM `forum` WHERE `type`='f' ORDER BY `realid`");
$i = 0;
while (($res = mysql_fetch_array($req)) !== false) {
echo $i % 2 ? '<div class="list2">' : '<div class="list1">';
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='r' and `refid`='" . $res['id'] . "'"), 0);
echo '<a href="forum/index.php?id=' . $res['id'] . '">' . $res['text'] . '</a> [' . $count . ']';
if (!empty($res['soft']))
echo '<div class="sub"><span class="gray">' . $res['soft'] . '</span></div>';
echo '</div>';
++$i;
}
echo '<div class="phdr"><b>' . $lng['statistics'] . '</b></div>';
//////////////Статистика форума///////////
$total_msg = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 'm'"), 0);
$total_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_files`"), 0);
$res = mysql_fetch_array(mysql_query("SELECT * FROM `users` ORDER BY `datereg` DESC LIMIT 1;"));
echo '<div class="gmenu"><p><h3></h3><ul>' .
'<li>Сообщений: ' . $total_msg . '  <span class="red">' . $total_msg_del . '</span></li>' .
'<li>Вложений: ' . $total_files . '</li>' .
'<li>Юзеров:  ' . counters::users() . '</li>' .
'<li>Последний: <a href="users/profile.php?user=' . $res['id'] . '">' . $res['name'] . '</a></li>' .
'</ul></p></div>';
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
unset($_SESSION['fsort_id']);
unset($_SESSION['fsort_users']);
}
?>
как вывести на глваную кол-во постов из одной определенной темы форума?
LYCUK, а можешь в .txt скинуть пожалуйста?
Dagestan_ец
$tid = 1000; //id темы
$mes_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 'm' AND `refid` = '$tid'"), 0);
вроде так