<?php
header("Content-Type: text/xml; charset=UTF-8");
mysql_connect("localhost", "gbnaam", "wwoord"); //Connect
mysql_select_db("forum"); //Database Connect
$url = ''; //De url van je forum. LET OP: ook de slash op het einde
$prefix= 'phpbb_'; //Wat voor elke tabel staat meestal phpbb_ als je wat anders hebt kun je het hier wijzigen!
$max = '10'; //Het aantal wat je wilt laten weergeven
echo '<?xml version="1.0"?>';
?>
<rss version="2.0">
<channel>
<title>De nieuwste Forum Berichten</title>
<link><?php echo $url; ?></link>
<description>
De nieuwste forum berichten</description>
<?php
$res = mysql_query("SELECT * FROM ".$prefix."posts ORDER BY post_time DESC LIMIT 0,".$max);
while ($arr = mysql_fetch_assoc($res)) {
?>
<item>
<title><?php
$titel = htmlentities($arr["post_subject"]);
echo $titel;
?>
</title>
<link><?php
echo $url."viewtopic.php?f=".$arr['forum_id']."&t=".$arr['topic_id'];
?>
</link>
<description>
<?php
$text = $arr['post_text'];
$tempArray = explode(' ',$text,11);
$aantal = count($tempArray);
if($aantal>10){ //101>100 ;)
//te veel woorden
array_pop($tempArray);
$text = implode(' ',$tempArray);
$text .= ' ...';
}
echo $text;
?>
</description>
</item>
<?php
}
mysql_free_result($res);
?>
</channel>
</rss>