ich habe mir ein kleines script geschrieben das aus der forum_id in der tabelle phpbb_forums_watch den forennamen aus der phpbb_forums tabelle ausliest so das dieser im template angezeigt wird!Nun würde ich zusätzlich gerne den Letzten Beitrag aus dem jeweiligen Forum anzeigen aber ich habe keine idee wie ich das hinbekommen kann!
Hier mal das script:
Code: Alles auswählen
<?php
/***************************************************************************
* topics.php
* -------------------
* begin : Friday, May 10, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$page_title = $lang['Topics_created'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$sql="SELECT fw.forum_id, fw.user_id, fw.notify_status, f.forum_name
FROM " . FORUMS_WATCH_TABLE . " fw, " . FORUMS_TABLE . " f
WHERE fw.user_id = '" . $userdata['user_id'] . "' AND fw.forum_id = f.forum_id
ORDER BY f.forum_id";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error getting forum information', '', __LINE__, __FILE__, $sql);
}
$numrows = $db->sql_numrows($result);
if ( $db->sql_numrows($result) > 0)
{
while ( $row = $db->sql_fetchrow($result) )
{
$forum_id = $row['forum_id'];
$forum_name = $row['forum_name'];
$template->assign_block_vars('abo_info', array(
'FORUM_NAME' => $forum_name,
'U_FORUM' => append_sid('viewforum.php?f='.$forum_id))
);
}
}
else
{
$nothing = "Zurzeit hast du keine Foren abonniert!";
$template->assign_block_vars('abo_info', array(
'FORUM_NAME' => $nothing)
);
}
$template->set_filenames(array(
'body' => 'abo_info.tpl')
);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Ich habe schon versucht den query so anzupassen:
Code: Alles auswählen
$sql="SELECT fw.forum_id, fw.user_id, fw.notify_status, f.forum_name, t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id
FROM " . FORUMS_WATCH_TABLE . " fw, " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE fw.user_id = '" . $userdata['user_id'] . "' AND fw.forum_id = f.forum_id AND t.forum_id !='$forum_id' AND t.topic_last_post_id
ORDER BY f.forum_name DESC";
Hat jemand ne idee wie ich das lösen kann?
Ich bin für jeden tip dankbar!
Grüße JLoop