Aufgabenstellung:
Mit Hilfe des NV_recent_topics-Mods möchte ich auf einer phpBB3-fremden Seite meiner Internetpräsenz die letzten 10 Topics des Forums anzeigen.
Dazu habe ich mir die functions_recenttopics.php in functions_recenttopics_front.php umbenannt und verändert. Folgender Quelltext:
Code: Alles auswählen
<?php
if (!defined('IN_PHPBB'))
{
exit;
}
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'config.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_display.php');
//$user->add_lang('mods/info_acp_recenttopics');
//$user_id = $user->data['user_id'];
//$limit = $config['rt_number'];
$rt_anti_topics = '0';
$rt_anti_topics = $config['rt_anti_topics'];
$onlyforum = 0;
$onlyforum = request_var('f', 0);
$sql = "SELECT * FROM phpbb_forums ORDER BY left_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if (strstr($onlyforum, $row['parent_id']))
{
$onlyforum .= ', ' . $row['forum_id'];
}
}
$db->sql_freeresult($result);
$forum_ary = array();
$forum_read_ary = $auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed)
{
if ($allowed['f_read'])
{
$forum_ary[] = (int) $forum_id;
}
}
$forum_ary = array_unique($forum_ary);
$forum_sql = (sizeof($forum_ary)) ? $db->sql_in_set('t.forum_id', $forum_ary, false) : $db->sql_in_set('t.forum_id', '0', false);
$keeponrunning = $topic_id = 0;
$sql = 'SELECT t.*, tp.topic_posted, f.forum_name, f.forum_type, f.forum_flags
FROM phpbb_topics t
LEFT JOIN phpbb_topics_posted tp ON t.topic_id = tp.topic_id
LEFT JOIN phpbb_forums f ON f.forum_id = t.forum_id
WHERE
(
f.forum_recent_topics = 1
' . (($onlyforum) ? ' AND f.forum_id IN (' . $onlyforum . ')': '') . "
" . (($rt_anti_topics) ? ' AND t.topic_id not IN (' . $rt_anti_topics . ')': '') . "
AND $forum_sql
)
OR t.topic_type IN (" . POST_GLOBAL . ")
GROUP BY t.topic_last_post_id
ORDER BY t.topic_last_post_time DESC
LIMIT 10";
$result = $db->sql_query($sql);
echo"<table width=\"100%\">"; //anfang tabelle
while ($row = $db->sql_fetchrow($result))
{
$topic_id = $row['topic_id'];
$forum_id = $row['forum_id'];
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $topic_id);
echo"<tr><td class=\"textnormalohnerahmen\" width=\"65%\"><a href=\"".$view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']."\">".censor_text($row['topic_title'])."</a></td>
<td class=\"textnormalohnerahmen\" width=\"35%\">".$row['forum_name']."</td></tr>";
}
echo"</table>"; //ende tabelle
$db->sql_freeresult($result);
?>
Code: Alles auswählen
<table width="100%"></table>
Bitte um Unterstützung.
Danke
EnzephaloN