<!-- Onderstaande deel (gaande van de eerste <?php tot de eerste afsluitende ?>
Bovenaan de pagina plaatsen, deze veroorzaakt GEEN output!-->
<?php
//CONFIG - EDIT!
$host = "localhost"; // De host van je mysql database
$user = "root"; // De login van je mysql database
$pass = ""; // Het paswoord van je database
$database = "forum"; // De naam van de database waaronder je phpbb forum opgeslagen staat.
$phpbb_root_path = '/forum/'; // De link naar je phpBB2 forum vanop deze pagina!
$numthreads = 10; // Het aantal topics dat moet worden opgehaald (std. 10)
//DONE CONFIG - EDIT!
//phpbbopties includen
if (!defined('IN_PHPBB'))
{
define('IN_PHPBB',true);
}
include_once ($phpbb_root_path . '/extension.inc');
include_once ($phpbb_root_path . '/common.'.$phpEx);
include_once ($phpbb_root_path . '/includes/bbcode.'.$phpEx);
include_once ($phpbb_root_path . '/includes/functions.'.$phpEx);
if (!$userdata)
{
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
}
?> <!-- Tot hier bovenaan de pagina plaatsen -->
<?php
//connectie met database opslaan
$connect = @mysql_connect($host,$user,$pass) or die("Fatal Error: could not connect to the database");
//connectie met juiste database maken!
mysql_select_db($database,$connect);
// Nieuws-tekst ophalen!
$nieuwssql = "SELECT
top.topic_id AS tid,
top.topic_replies AS replies,
top.topic_time AS time,
text.post_subject AS subject,
text.post_text AS text,
text.bbcode_uid AS bbcode_uid,
user.user_email AS email,
user.username AS username
FROM
phpbb_topics top
LEFT JOIN phpbb_posts_text text ON post_id = top.topic_first_post_id
LEFT JOIN phpbb_users user ON user.user_id=top.topic_poster
ORDER BY topic_time DESC LIMIT 0,$numthreads";
$nieuwsquery = mysql_query($nieuwssql) or die(mysql_error()." AT SCRIPT LINE " .__LINE__);
while($nieuws = mysql_fetch_assoc($nieuwsquery))
{
$poster = $nieuws['username'];
$poster_email = $nieuws['email'];
$topicid = $nieuws['tid'];
$time = $nieuws['time'];
$replies = $nieuws['replies'];
$link = $phpbb_root_path.'/viewtopic.php?t='.$topicid;
$inhoud = $text['text'];
$titel = $text['subject'];
$bbuid= $text['bbcode_uid'];
$datum = date("H:i d/m/Y",$time);
//bb code!
stripslashes($inhoud);
$inhoud = bbencode_second_pass($inhoud, $bbuid);
$inhoud = smilies_pass($inhoud);
$inhoud = str_replace('images/smiles', $phpbb_root_path.'/images/smiles', $inhoud);
$inhoud = nl2br($inhoud);
// BB code eind
?>
<!-- JOUW html code om de topics weer te geven, zet onderstaande nodes op de juiste plaats -->
<?=$datum?> <!-- Geeft de datum weer !-->
<?=$inhoud?> <!-- Geeft de inhoud weer van de topic (de eerste post dus, geen replies!) -->
<?=$titel?> <!-- Geeft de titel van de topic weer -->
<?=$replies?> <!-- Geeft het aantal replies op de topic terug -->
<?=$link?> <!--Geeft een link naar de topic terug (NOG NIET IN een <a>-tag geplaatst!), bv. http:// forum.com/viewtopic.php?t=1 -->
<?=$datum?> <!--Geeft de Datum + uur terug-->
<?=$poster?> <!--Geeft de naam van de poster terug -->
<?=$poster_email?> <!-- Het email adres van de poster -->
<!-- Andere opmaak code pas na volgende <?php ?>-tags toevoegen, of deze zal ook herhaald worden! -->
<?php
}
?>