23.03.06, 13:01:35
mristau2k5
Ich hab für mein Forum mal ne kleine Änderung an der News-Portalbox hier aus dem Download-Bereich vorgenommen, man kann ja standardmäßig 1 Forum anzeigen lassen, ich hab das jetzt so erweitert, dass man mehrere Foren anzeigen kann.
Suche:
[CODE]
#hier muss die board id des News Forums eingetragen werden.
$news_board = 3; // Foren ID für die News
#Ab hier nichts mehr ändern.
$news = $_db->query('SELECT p.`id`,
p.`post_date`,
p.`topic_id`,
p.`text`,
p.`bbcode`,
p.`html`,
p.`smilie`,
t.`name`,
t.`posts`,
t.`views`,
t.`id` AS `topic_id`,
u.`name` AS `user_name`
FROM `'.$_cfg['DB_PREFIX'].'topic` AS t,
`'.$_cfg['DB_PREFIX'].'post` AS p,
`'.$_cfg['DB_PREFIX'].'user` AS u
WHERE t.`post_date` = p.`post_date`
AND p.`user_id` = u.`id`
AND t.`board_id` = '.$news_board.'
GROUP BY t.`id`
ORDER BY p.`post_date` DESC
LIMIT 5');
[/CODE]
Ersetze mit:
[CODE]
#hier muss die board id des News Forums eingetragen werden.
$news_boards = array(4, 5, 6); // Foren ID für die News
$boards = '';
#Ab hier nichts mehr ändern.
foreach ($news_boards as $news_board)
{
$boards .= 't.`board_id` = '.$news_board.' OR ';
}
$boards = substr($boards, 0, strlen($boards)-4);
$news = $_db->query('SELECT p.`id`,
p.`post_date`,
p.`topic_id`,
p.`text`,
p.`bbcode`,
p.`html`,
p.`smilie`,
t.`name`,
t.`posts`,
t.`views`,
t.`id` AS `topic_id`,
u.`name` AS `user_name`
FROM `'.$_cfg['DB_PREFIX'].'topic` AS t,
`'.$_cfg['DB_PREFIX'].'post` AS p,
`'.$_cfg['DB_PREFIX'].'user` AS u
WHERE t.`post_date` = p.`post_date`
AND p.`user_id` = u.`id`
AND '.$boards.'
GROUP BY t.`id`
ORDER BY p.`post_date` DESC
LIMIT 5');
[/CODE]