NV_recent_topics MOD modden

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 3.0 hat das Ende seiner Lebenszeit überschritten
phpBB 3.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 3.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf die neuste phpBB-Version, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
EnzephaloN
Mitglied
Beiträge: 30
Registriert: 09.01.2003 15:51
Wohnort: Weimar
Kontaktdaten:

NV_recent_topics MOD modden

Beitrag 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
EnzephaloN
Mitglied
Beiträge: 30
Registriert: 09.01.2003 15:51
Wohnort: Weimar
Kontaktdaten:

Beitrag 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
AttilaG
Mitglied
Beiträge: 119
Registriert: 06.09.2007 16:20
Kontaktdaten:

Beitrag 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
Antworten

Zurück zu „[3.0.x] Mod Support“