Scripts

phpBB3 : Laatste topics

Met dit scriptje kan je de laatste x topics van een phpBB3 forum laten zien. LET OP: Je moet in het begin van de code enkele dingen aanpassen, zoals de MySQL gegevens, domeinnaam, rootpath etc.. etc.. om alle links en dergelijke te laten werken!! Samenvatting: - Laatste x topics (zelf instelbaar) - Includes: Topicstarter, wat overige info en een 'reageer nu'-link - Refresh knop (kan je van het voorbeeld pakken, anders hier: http://files.wesdesignz.nl/lastnews/redo.gif) - De topicposters worden in hun kleur wat ze op het forum ook hebben geshowd. Dus is je forumrang op het forum bijvoorbeeld Admin, en je kleur dus Donkerbruin, is de topicstarter zijn naam bruin, en iets dikgedrukt. EDIT: Reageer nu knop is even dood, word aan gewerkt Re-edit: Opgelost

phpbb3-laatste-topics
[code]
<?php

############
## MySQL #####
############
$MySQL['server'] = "";
$MySQL['user'] = "";
$MySQL['passw'] = "";
$MySQL['db'] = "";

mysql_connect($MySQL['server'], $MySQL['user'], $MySQL['passw'])or die("<center><br><br><h1 style=\"font-size: 50px;\">MySQL Error</h><br><br><font style=\"font-family: Verdana; font-size: 10px;\">".mysql_error()."</font></center>");
mysql_select_db($MySQL['db'])or die("<center><br><br><h1 style=\"font-size: 50px;\">MySQL Error</h><br><br><font style=\"font-family: Verdana; font-size: 10px;\">".mysql_error()."</font></center>");

###############
## MySQL - Queries ##
###############

## Gegevens
# Tabelvoorvoegsel:
$PHPBB['pre'] = "bb3_";
# Aantal topics
$PHPBB['maxtopics'] = 20;

## Queries
# Query
$query = "SELECT * FROM ".$PHPBB['pre']."topics LIMIT 0,".$PHPBB['maxtopics']."";
# Result
$result = mysql_query($query);
# Affected
if ($result != NULL ) {
$num_rows = mysql_num_rows($result);
} else {
$num_rows = 0;
}
# Forum domein:
$PHPBB['site_titel'] = "Wesdesignz Forum";
$PHPBB['domain'] = "http://forum.wesdesignz.nl";
$PHPBB['map'] = "/"; // (Note, als het op het domein zelf staat, of op een subdomein in de rootmap, laat hier / staan!!
$PHPBB['loc'] = $PHPBB['domain'].$PHPBB['map'];
## Hierna output maken
?>
<html>
<head>
<title>Laatste <?= $PHPBB['maxtopics'] ?> topics van <?= $PHPBB['site_titel'] ?></title>
<style type="text/css">
<!--
* {
margin: 0;
padding: 0;
}
body {
background-color: #232323;
}
#box {
border-style: solid;
border-width: 1px;
border-color: #000000;
background-color: #DDDDDD;
}
font.head {
font-family: Verdana;
font-size: 30px;
font-style: normal;
font-weight: bold;
color: #FFFFFF;
padding-top: 5px;
}
font.box-inhoud {
font-family: Verdana;
font-size: 10px;
font-style: normal;
font-weight: normal;
color: #000000;
}
a {
color: #000000;
text-decoration: none;
}
a:hover {
color: #AAAAAA;
text-decoration: underline;
}
-->
</style>
</head>
<body>
<center><font class="head">Laatste <?= $PHPBB['maxtopics'] ?> topics van <?= $PHPBB['site_titel'] ?></font><br>
<br>
<div id="box">
<?php
if ($num_rows >= 1) {
?>
<table border="0" style="font-family: Verdana; font-size: 10px;">
<tr style="font-weight: bold;">
<td style="width: 70px;">Topic id:</td>
<td style="width: 200px;">Topic:</td>
<td style="width: 175px;">Topicstarter:</td>
<td style="width: 250px;">Overige info:</td>
</tr>
<?php
while ($resultset=mysql_fetch_array($result)) {
?>
<tr style="font-weight: normal;">
<td><?= $resultset[topic_id] ?></td>
<td><a href="<?= $PHPBB['loc'] ?>viewforum.php?f=<?= $resultset[forum_id] ?>&t=<?= $resultset[topic_id] ?>"><?= $resultset[topic_title] ?></a></td>
<td><a href="<?= $PHPBB['loc'] ?>memberlist.php?mode=viewprofile&u=<?= $resultset[topic_poster] ?>">
<?php
if (isset($resultset[topic_first_poster_colour])) {
echo '<font style="font-weight: bold; color: '.$resultset[topic_first_poster_colour].'">'.$resultset[topic_first_poster_name].'</font>';
} else {
echo '<font style="font-weight: normal; color: #000000;">'.$resultset[topic_first_poster_name].'</font>';
}
?>
</a></td>
<td>
<?php
if ($resultset[topic_replies] == 0) {
$nr_replies = "<i>Nog geen";
} elseif ($resultset[topic_replies] == 1) {
$nr_replies = "1";
} elseif ($resultset[topic_replies] >= 2) {
$nr_replies = $resultset[topic_replies];
}
?>
<?= $resultset[topic_views] ?> keer bekenen (<?= $nr_replies ?> reactie's</i>)
</td>
<td>
<a href="<?= $PHPBB['loc'] ?>posting.php?mode=reply&f=<?= $resultset[forum_id] ?>&t=<?= $resultset[topic_id] ?>">Reageer nu</a>
</td>
</tr>
<?php
}
} else {
echo '<center><br><font style="font-family: Verdana; font-size: 10px; font-weight: bold; color: red;">Geen topics gevonden</font></center><br>';
}
?>
<center><a href=""><img src="redo.gif" alt="Refresh" border="0" style="width: 50px; height: 50px;" title="Refresh"></a>
</body>
</html>
[/code]

Reacties

0
Nog geen reacties.