Letzte Beiträge via php auslesen
Verfasst: 06.08.2007 12:25
Hi,
Ich benötige mal eine kleine Hilfe.
Beim phpbb2 habe ich ein phpscript hier mal bekommen welches die letzten 10 Topics ausliest.
Daher die phpbb3 Struktur anders ist benötige ich hilfe beim Umschreiben.
Hier mal das Script:
Bin leider nicht super php gewandt und erst recht nicht bei dem phpbb
Vielleicht wäre einer so nett und kann mir dabei helfen.
Ich benötige mal eine kleine Hilfe.
Beim phpbb2 habe ich ein phpscript hier mal bekommen welches die letzten 10 Topics ausliest.
Daher die phpbb3 Struktur anders ist benötige ich hilfe beim Umschreiben.
Hier mal das Script:
Code: Alles auswählen
<?
define("TOPIC_COUNT", 10);
define("PHPBB_PATH", "/home/.........Hier mein Pfad/");
define("PHPBB_LOCATION", "http://.......hier meine Forumurl");
define("TIME_FORMAT", "H:i");
$phpbb_root_path = PHPBB_PATH;
$phpEx = "php";
if ( !defined('IN_PHPBB') )
{
define('IN_PHPBB', true);
include(PHPBB_PATH . 'extension.inc');
include(PHPBB_PATH . 'config.'.$phpEx);
include(PHPBB_PATH . 'includes/constants.'.$phpEx);
include(PHPBB_PATH . 'includes/db.'.$phpEx);
}
$sql = "SELECT DISTINCT f.forum_id, t.topic_title, t.topic_last_post_id, p.post_time, f.forum_name FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f WHERE t.forum_id = f.forum_id AND p.topic_id = t.topic_id AND p.post_id = t.topic_last_post_id ORDER BY p.post_time DESC LIMIT " . TOPIC_COUNT;
$nt_result = $db->sql_query($sql);
if(!$nt_result)
{
die("Failed obtaining list of active topics".mysql_error());
}
else
{
$nt_data = $db->sql_fetchrowset($af_result);
}
if ( count($nt_data) == 0 )
{
die("No topics found");
}
else
{
for ($i = 0; $i < count($nt_data); $i++)
{
$title = $nt_data[$i]['topic_title'];
$url = PHPBB_LOCATION . 'viewtopic.' . $phpEx . "?" . POST_POST_URL . "=" . $nt_data[$i]['topic_last_post_id'] . "#" . $nt_data[$i]['topic_last_post_id'];
$on_forum = 'On the ' . $nt_data[$i]['forum_name'] . ' forum';
$post_time = date(TIME_FORMAT, $nt_data[$i]['post_time']);
echo "<font style=\"font-family: verdana, arial, helvetica, sans-serif; font-size: 10px; color: #f5f5f5; text-decoration: none; font-weight: normal;\"> - <a href=\"$url\" title=\"$on_forum ($title)\" target=\"Hauptframe\">$title</a></font><br>";
}
}
?>
