Seite 1 von 1

NV_recent_topics MOD modden

Verfasst: 11.03.2008 09:09
von EnzephaloN
Hallo

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);

?>
Leider zeigt es mir nur ne leere Seite

Code: Alles auswählen

<table width="100%"></table>
Irgendwas stimmt noch nicht mit der Datenbankabfrage, ich schau da aber jetzt nicht mehr durch. Jemand nen Tip? Warhscheinlich werden n paar Variablen benutzt, an die das Script in der abgeänderten/ausgegliederten Version nicht rankommt.

Bitte um Unterstützung.

Danke
EnzephaloN

Verfasst: 15.03.2008 19:53
von EnzephaloN
Hab mir jetzt auf Grundlage meines obrigen Posts und des alten phpBB2-Mods recent_topics selber was "gefrickelt". Funktioniert auch super, wenn auch nicht ganz so schön zu administrieren wie der Original-Mod.
Die UTF8-Codierungsprobleme konnte ich hoffentlich dank der utf8_decode Funktion lösen.

Grüße
EnzephaloN

Verfasst: 22.03.2008 21:26
von AttilaG
Hallo EnzephaloN

Ich habe gerade nach der gleichen Anwendung gesucht und nun zufällig deinen Post gefunden. Nun hätte ich zwei Fragen dazu:

Kannst du mir eine URL angeben, wo man deinen Mod am MOD sehen kann?

Könntest du auch deine finale Lösung publizieren?

Danke
-- Attila