Code: Select all
<?php
/* gets last X topics from your phpBB */
/* settings... */
/* setup your mysql conn... */
mysql_connect("host","user","pass");
/* enter your DB */
mysql_select_db("database");
/* how many to display? */
/* to display ALL, go and remove " LIMIT $display" from $get_q. */
$display = 5;
/* character cut-off */
/* (set to 0 for NO cut off) */
$cutoff = 20;
/* if cutoff is used, what should be displayed after? */
/* hint: usually "..." or something. */
$cutoffending = "...";
/* URL to your forum (DIRECTORY ONLY!) */
/* ie: /phpBB2 */
/* _NO_ trailing slash! */
$url = "/forums";
/* --- end settings! --- */
$get_q = "SELECT topic_id,topic_title FROM topics ORDER BY topic_id DESC LIMIT $display";
$get_r = mysql_query($get_q);
while ($topic = mysql_fetch_row($get_r)) {
if ($cutoff != 0) {
if(strlen($topic[1]) > $cutoff) {
$link = substr($topic[1], 0, $cutoff) . $cutoffending;
} else {
$link = $topic[1];
}
} else {
$link = $topic[1];
}
echo ". <a href=$url/viewtopic.php?t=$topic[0]>$link</a><br>\n";
}
/* end... */
/* CREDIT: Scott Roberts - http://z00om.com */
?>