Seite 1 von 1

[Erledigt] Last Post Topic Index Mod - Link ändern

Verfasst: 25.10.2004 10:10
von erbsen
Hallo Leute

Ich habe den Last Post Topic Index14a installiert.

Code: Alles auswählen

Mod Title:   shows topic of last made post on index
Mod Version: 1.4.0
Author:      e-sven <sven@e-sven.net> http://www.e-sven.net
Description: -adds lasts post topic to each forum on
              the index page (based on read-access)
	     -word censorship is used
	     -topic title with more then 27 chars are cut off
	     -mouseover info displays the full title
Dadurch wird der der Titel des letzten Beitrags jedes Forums in der Spalte
"Letzter Beitrag" auf dem Index als Link dargestellt (Ich hoffe Ihr versteht
das).
Jetzt habe ich in der Spalte "Letzter Beitrag" (Index) den Link mit dem Titel
und das Zettel-Symbol.
Beide Links führen mich zum letzten geschriebenen Beitrag.
Der Link auf den Titel soll aber zum Anfang des Threads führen, wie kriege ich das hin ?

Forum
LastPostTopicIndex14a.txt

erbsen

Verfasst: 26.10.2004 10:20
von erbsen
Hi

ist zwar nur ein Schönheitsfehler aber es stört.

Bitte helfen.

erbsen

Verfasst: 27.10.2004 10:15
von erbsen

Code: Alles auswählen

#
#-----[ OPEN ]----------------------[phpBB 2.0.5]--------------------------
#
index.php

#
#-----[ ACTION Find ]---------------[phpBB 2.0.5]--------------------------
#

		default:
			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
				FROM (( " . FORUMS_TABLE . " f
				LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
				LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
				ORDER BY f.cat_id, f.forum_order";
			break;
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_data = array();
	while( $row = $db->sql_fetchrow($result) )
	{
		$forum_data[] = $row;
	}

	if ( !($total_forums = count($forum_data)) )
	{
		message_die(GENERAL_MESSAGE, $lang['No_forums']);
	}

	//
	// Obtain a list of topic ids which contain

#
#-----[ REPLACE WITH ]----------------------------------------
#

default:
 		$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id " .
			" FROM ((( " . FORUMS_TABLE . " f " .
			" LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )" .
			" LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) " .
			" LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = p.post_id ) " .
			" ORDER BY f.cat_id, f.forum_order";
		break;
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_data = array();
	$topic_last_ary = array();
	$i=0;
	while( $row = $db->sql_fetchrow($result) )
	{
		if (!in_array($row['topic_last_post_id'], $topic_last_ary) || $row['topic_last_post_id']==0) {
			$topic_last_ary[i]=$row['topic_last_post_id'];
			$i++;
			$forum_data[] = $row;
		}
	}
	unset($topic_last_ary);
	if ( !($total_forums = count($forum_data)) )
	{
		message_die(GENERAL_MESSAGE, $lang['No_forums']);
	}
	
	//
	// Filter topic_title not allowed to read
	// 
	if ( !($userdata['user_level'] == ADMIN && $userdata['session_logged_in']) ) {
		$auth_read_all = array();
		$auth_read_all=auth(AUTH_READ, AUTH_LIST_ALL, $userdata, $forum_data);
		$auth_data = '';
		for($i=0; $i<count($forum_data); $i++)
		{
			if (!$auth_read_all[$forum_data[$i]['forum_id']]['auth_read']) {
				$forum_data[$i]['topic_title']='';
			}
		}
	}

	//
	// Define censored word matches
	//
	$orig_word = array();
	$replacement_word = array();
	obtain_word_list($orig_word, $replacement_word);

	//
	// Obtain a list of topic ids which contain


#
#-----[ ACTION Find ]------------------[phpBB 2.0.5]-----------------------
#
							if ( $forum_data[$j]['forum_last_post_id'] )
							{
								$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

								$last_post = $last_post_time . '<br />';

								$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
								
								$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
							}
#
#-----[ ACTION Replace With ]---------------------------------
#
	if ( $forum_data[$j]['forum_last_post_id'] )
	{
		$topic_title = $forum_data[$j]['topic_title'];
		$topic_title2 = $forum_data[$j]['topic_title'];
		
		//
		// Censor topic title
		//
		if ( count($orig_word) )
		{
			$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
			$topic_title2 = preg_replace($orig_word, $replacement_word, $topic_title2);
		}
										
		if (strlen($topic_title)>27) {
			$topic_title = substr($topic_title,0,24) . '...';
		}

		$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
		$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>';
		$last_post .= $last_post_time . '&nbsp;<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '"></a><br>' . $lang['by'] . '&nbsp;';
		$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
	}

#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------
#
Was muß geändert werden damit man in der rechten Spalte (Letzter Beitrag) beim Klick auf das Thema zum Themenanfang gelangt und nicht zum letzten geschriebenen Beitrag ?

erbsen

Verfasst: 28.10.2004 10:16
von erbsen
Tja, ich bin´s wieder.

Nichts zu machen ?


erbsen

Verfasst: 29.10.2004 10:42
von erbsen
Schade eigentlich, hätte mich doch brennend interessiert !

erbsen

Verfasst: 30.10.2004 12:21
von erbsen
nicht mal eine Frage / Bemerkung ?

erbsen

Verfasst: 31.10.2004 08:38
von erbsen
einmal noch


erbsen

Verfasst: 31.10.2004 09:49
von saerdnaer
suche:

Code: Alles auswählen

$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id "
ersetzen durch

Code: Alles auswählen

$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id, t.topic_id "
suche:

Code: Alles auswählen

$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>'; 
ersetzen durch

Code: Alles auswählen

$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_TOPIC_URL . '=' . $forum_data[$j]['topic_id']) . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>'; 
ah

Verfasst: 31.10.2004 10:40
von erbsen
Super saerdnaer !

Du bist mein Retter.
Genauso sollte es sein, funktioniert einwandfrei. :D
Hätte das Thema morgen gelöscht.

Heißen Dank


erbsen