How to show 10 topics in Last Posts menu on Homepage on johncms 4.4+ for all user. Please Help me.
nomanbd,
$lim_top = '10'; ///the limit of messages, change its surprising number
$req = mysql_query("SELECT * FROM `forum` where type='t' ORDER BY time DESC LIMIT $lim_top");
$i = 0;
while ($res = mysql_fetch_array($req)){
$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);
///icons
$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 '<div class="menu"> ';
echo functions::display_menu($icons, ' ', ' ');
echo '<a href="forum/index.php?id='.$res['id'].'">'.$res['text'].'</a> ['.$colmes1.']';
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>';
echo '</div>';
$i;
}
?>
That'll be a plus in karma
This is the conclusion to his native forum. I can give a conclusion without the author and other garbage=)
За попрошайничество можно и минус 10 получить