Laatste Reacties MOD
Geplaatst: 11 nov 2007, 20:03
- Modificatie & Versie: Laatste reacties MOD
Directe link naar de modificatie: http://www.allesvoorjehuis.nl
Adres van je forum: http://www.allesvoorjehuis.nl/forum
phpBB versie: 3 RC7
Ik zie heel vaak dat er mensen op zoek zijn naar een MOD om de Laatste reacties te tonen op een aparte pagina van je website.
Ik heb een MOD van een vriend van mij gekregen en weet niet of hij hier vandaan komt deze MOD.
Ik heb gezocht maar kan hem in ieder geval niet vinden op forum en wil hem daarom aanbieden aan de mensen die er iets aan hebben. Daarnaast weet ik niet of ik het zo goed plaatst maar dan kan een beheerder hem wel even in het juiste onderdeel zetten.
Op http://www.allesvoorjehuis.nl zie je een voorbeeld onder de slideshow.
Voeg dit toe in je file waar je hem wilt hebben:
Code: Selecteer alles
<?php include "last.php"; ?>
---------------------------------------------
Code: Selecteer alles
<?PHP
// adjust this to your needs
$CFG['db_host'] = '**********';
$CFG['db_user'] = '**********';
$CFG['db_pass'] = '**********';
$CFG['db_name'] = '**********';
$CFG['font_face'] = 'Arial';
$CFG['font_size'] = '2';
$CFG['number_of_posts'] = '5';
$CFG['phpbb_table_prefix'] = 'phpbb_';
$CFG['phpBB_folder'] = './forum/'; //Here you have to put de root map of the forum.
// ignore forums (indicated by the forum number)
// you can put between '' a number of the forum you want to ignore)
//$IGNORE[0] = '4';
//$IGNORE[1] = '7';
//$IGNORE[2] = '9';
define('IN_PHPBB',true);
include_once ($CFG['phpBB_folder'] . 'extension.inc');
$DB = '';
$postspp = '';
$phpEx = 'php';
function phpbb_news() {
global $CFG, $DB, $IGNORE, $postspp;
// connect the DB
$DB = mysql_connect($CFG['db_host'], $CFG['db_user'], $CFG['db_pass']);
if (!$DB) {
die('Unable to connect to database.');
}
mysql_select_db($CFG['db_name']) or die('Unable to select database');
// get number of posts per page
$sql = 'SELECT config_value FROM ' . $CFG['phpbb_table_prefix'] . 'config WHERE config_name = \'posts_per_page\'';
$query = mysql_query($sql, $DB);
$row = mysql_fetch_row($query);
$postspp = $row[0];
// this is the SQL statement
// in the WHERE clause I had to add a time limit
// due to some corrupt posting times in my forum
$sql = 'SELECT
p.post_time,
t.topic_title,
t.topic_id,
f.forum_name,
f.forum_id,
t.topic_replies
FROM
' . $CFG['phpbb_table_prefix'] . 'topics AS t,
' . $CFG['phpbb_table_prefix'] . 'forums AS f,
' . $CFG['phpbb_table_prefix'] . 'posts AS p
WHERE
t.forum_id = f.forum_id AND
#f.auth_read = ' . '0' .' AND
p.post_id = t.topic_last_post_id ';
for ($i = 0; $i < count($IGNORE); $i++) {
$sql .= 'AND t.forum_id <> ' . $IGNORE[$i] . ' ';
}
$sql .= 'ORDER BY
t.topic_last_post_id DESC
LIMIT
0,' . $CFG['number_of_posts'];
$query = mysql_query($sql, $DB);
// fetch the result
$i = 0;
while ($row = mysql_fetch_row($query)) {
// you can refer to theses elements later
$post[$i]['topic_time'] = $row[0];
$post[$i]['topic_title'] = $row[1];
$post[$i]['topic_id'] = $row[2];
$post[$i]['forum_name'] = $row[3];
$post[$i]['forum_id'] = $row[4];
$post[$i]['numposts'] = $row[5];
$post[$i]['date'] = date('d.m', $post[$i]['topic_time']);
$post[$i]['time'] = date('H:i', $post[$i]['topic_time']);
$i++;
}
return $post;
}
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php
$news = phpbb_news();
for ($i = 0; $i < count($news); $i++) {
?>
<tr>
<td width="80" align="left" valign="top">
<?PHP
$font_face = $CFG['font_face'];
$font_size = $CFG['font_size'];
echo("<font face=\"$font_face\" size=\"$font_size\">");
echo($news[$i]['date']);
echo(" ");
echo($news[$i]['time']);
echo("</font>");
?></td>
<td width="160" align="left" valign="top">
<?PHP
$forum_id = $CFG['phpBB_folder'] . "viewforum." . $phpEx . "?f=" . $news[$i]['forum_id'];
echo("<font face=\"$font_face\" size=\"$font_size\">");
echo("<a href=\"$forum_id\" target=_blank>");
echo($news[$i]['forum_name']);
echo("</a>");
echo("</font>");
?></td>
<td align="left" valign="top">
<?PHP
$topic_id = $CFG['phpBB_folder'] . "viewtopic." . $phpEx . "?t=" . $news[$i]['topic_id'];
$start = $news[$i]['numposts'] - ($news[$i]['numposts'] % $postspp);
if ($start != 0) {
$topic_id .= "&start=$start";
}
echo("<font face=\"$font_face\" size=\"$font_size\">");
echo("<a href=\"$topic_id\" target=_blank>");
echo($news[$i]['topic_title']);
echo("</a>");
echo("</font>");
?></td>
</tr>
<?PHP
}
?>
</table>