Kombination "today at" und "last topic"

Probleme bei der regulären Arbeiten mit phpBB, Fragen zu Vorgehensweisen oder Funktionsweise sowie sonstige Fragen zu phpBB im Allgemeinen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.1, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
eXup
Mitglied
Beiträge: 78
Registriert: 03.05.2002 09:25
Kontaktdaten:

Kombination "today at" und "last topic"

Beitrag von eXup »

Hi All,

ich habe gesucht und gesucht, aber leider nichts gefunden.

Würde gerne den Mod "Last Topic" zusätzlich zum bereits vorhandenen "Today at" einbauen.
abei lege ich mir momentan die Karten. Hat das schon jemand gemacht und kann mir vielleicht bei
der Änderung im 2. Teil der index.php helfen? - Wäre echt klasse...

Danke schonmal.
Gruss vom eX
Acid
Ehrenadmin
Beiträge: 12195
Registriert: 26.04.2001 02:00
Wohnort: Berlin

Beitrag von Acid »

...hättest mal einen Link zum "Today" Hack?
Benutzeravatar
eXup
Mitglied
Beiträge: 78
Registriert: 03.05.2002 09:25
Kontaktdaten:

Beitrag von eXup »

Hmm,

den Link kann ich gerade nicht finden, deshalb hier der Mod den ich meine:

Code: Alles auswählen

################################################################# 
## Mod Title:    Today At/Yesterday At 
## Mod Version:  1.2.1 
## Author:       blulegend 
## Description:  Will show Today At if the post was posted today 
##               Will show Yesterday At if the post was posted yesterday 
## 
##               Modifies in index, viewforum, viewtopic, and search! 
## 
##               Includes code compatible with Daylight Savings Time Mod 
## 
## Installation Level:  Easier than easy! 
## Installation Time:   10-15 Minutes 
## Files To Edit:       6 
## Included Files:      None 
################################################################# 
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites 
################################################################# 
## 
## Author Note: 
## Enjoy! 
## 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 
# 
#-----[ OPEN ]------------------------------ 
# 

/includes/pageheader.php 

# 
#-----[ FIND around line 70 ]----------------------------------- 
# 

// 
// Parse and show the overall header. 
// 

# 
#-----[ BEFORE, ADD ]----------------------------------- 
# 

// 
// PARSE DATEFORMAT TO GET TIME FORMAT // TODAY AT MOD 
// 
$time_reg = '([gh][[:punct:][:space:]]{1,2}[i][[:punct:][:space:]]{0,2}[a]?[[:punct:][:space:]]{0,2}[S]?)'; 
eregi($time_reg, $board_config['default_dateformat'], $regs); 
$board_config['default_timeformat'] = $regs[1]; 
unset($time_reg); 
unset($regs); 

// 
// GET THE TIME TODAY AND YESTERDAY 
// 
$today_ary = explode('|', create_date('m|d|Y', time(),$board_config['board_timezone'])); 
$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'],0,0,$today_ary[0],$today_ary[1],$today_ary[2]); 
$board_config['time_yesterday'] = $board_config['time_today'] - 86400; 
unset($today_ary); 

# 
#-----[ OPEN ]------------------------------ 
# 

/index.php 

# 
#-----[ FIND around line 380 ]----------------------------------- 
# 

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

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

                        // OLD 
                        // $last_post = $last_post_time . '<br />'; 
                        // 
                        // TODAY AT MOD 
                        // 
                        if ( $board_config['time_today'] < $forum_data[$j]['post_time']) 
                        { 
                           $last_post = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone'])) . '<br />'; 
                        } 
                        else if ( $board_config['time_yesterday'] < $forum_data[$j]['post_time']) 
                        { 
                           $last_post = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone'])) . '<br />'; 
                        } 
                        else 
                        { 
                           $last_post = $last_post_time . '<br />'; 
                        } 
                        // END MOD 

# 
#-----[ OPEN ]------------------------------ 
# 

/search.php 

# 
#-----[ FIND around line 745 ]----------------------------------- 
# 

         $post_date = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); 

# 
#-----[ AFTER, ADD ]----------------------------------- 
# 

         // 
         // TODAY AT MOD 
         // 
         if ( $board_config['time_today'] < $searchset[$i]['post_time']) 
         { 
            $post_date = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
         } 
         else if ( $board_config['time_yesterday'] < $searchset[$i]['post_time']) 
         { 
            $post_date = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
         } 
         // END MOD 

# 
#-----[ FIND around line 1120 ]----------------------------------- 
# 

            $last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); 

# 
#-----[ AFTER, ADD ]----------------------------------- 
# 

            // 
            // TODAY AT MOD 
            // 
            if ( $board_config['time_today'] < $searchset[$i]['post_time']) 
            { 
               $last_post_time = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
            } 
            else if ( $board_config['time_yesterday'] < $searchset[$i]['post_time']) 
            { 
               $last_post_time = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
            } 
            // END MOD 

# 
#-----[ OPEN ]------------------------------ 
# 

/viewforum.php 

# 
#-----[ FIND around line 630 ]----------------------------------- 
# 

      $last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']); 

# 
#-----[ AFTER, ADD ]----------------------------------- 
# 

      // 
      // TODAY AT MOD 
      // 
      if ( $board_config['time_today'] < $topic_rowset[$i]['post_time']) 
      { 
         $last_post_time = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone'])); 
      } 
      else if ( $board_config['time_yesterday'] < $topic_rowset[$i]['post_time']) 
      { 
         $last_post_time = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone'])); 
      } 
      // END MOD 

# 
#-----[ OPEN ]------------------------------ 
# 

/viewtopic.php 

# 
#-----[ FIND around line 806 ]----------------------------------- 
# 

   $post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']); 

# 
#-----[ AFTER, ADD ]----------------------------------- 
# 

   // 
   // TODAY AT MOD 
   // 
   if ( $board_config['time_today'] < $postrow[$i]['post_time']) 
   { 
      $post_date = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $postrow[$i]['post_time'], $board_config['board_timezone'])); 
   } 
   else if ( $board_config['time_yesterday'] < $postrow[$i]['post_time']) 
   { 
      $post_date = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $postrow[$i]['post_time'], $board_config['board_timezone'])); 
   } 
   // END MOD 

# 
#-----[ OPEN ]------------------------------ 
# 

/language/lang_xxx/lang_main.php 

# 
#-----[ FIND at end of file ]----------------------------------- 
# 

// 
// That's all Folks! 
// ------------------------------------------------- 

# 
#-----[ BEFORE, ADD ]----------------------------------- 
# 

// TODAY AT MOD 
$lang['Today_at'] = "Today at %s"; // %s is the time 
$lang['Yesterday_at'] = "Yesterday at %s"; // %s is the time 
// 

# 
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------- 
# EoM

Den habe ich eingebaut, und habe jetzt das Problem, dass die index.php dadurch ja schon verändert wurde.
Dort wo der "last topic" diese Veränderung erfordert

Code: Alles auswählen

#
#-----[ ACTION Find ]-----------------------------------------
#
	if ( $forum_data[$j]['forum_last_post_id'] )
	{
	...
	}


#
#-----[ 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> ';
	}

stehe ich auf dem Schlauch.

Meine index.php sieht in dem Bereich so aus:

Code: Alles auswählen

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

								// OLD 
                        // $last_post = $last_post_time . '<br />'; 
                        // 
                        // TODAY AT MOD 
                        // 
                        if ( $board_config['time_today'] < $forum_data[$j]['post_time']) 
                        { 
                           $last_post = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone'])) . '<br />'; 
                        } 
                        else if ( $board_config['time_yesterday'] < $forum_data[$j]['post_time']) 
                        { 
                           $last_post = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone'])) . '<br />'; 
                        } 
                        else 
                        { 
                           $last_post = $last_post_time . '<br />'; 
                        } 
                        // END MOD

								$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>';
							}
							else
							{
								$last_post = $lang['No_Posts'];
							}

							if ( count($forum_moderators[$forum_id]) > 0 )
							{
								$l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
								$moderator_list = implode(', ', $forum_moderators[$forum_id]);
							}
							else
							{
								$l_moderators = '&nbsp;';
								$moderator_list = '&nbsp;';
							}

							$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
							$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

(Sorry für die langen Codes)
Gruss vom eX
Benutzeravatar
Henne
Ehemaliges Teammitglied
Beiträge: 4520
Registriert: 04.01.2002 01:00
Wohnort: Lage (Lippe)
Kontaktdaten:

Beitrag von Henne »

Versuch mal das (keine Garantie, da von mir kopiert und ich nicht weiß, ob es Versionskonflikte mit deiner Version gibt):

Code: Alles auswählen

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> '; 
   
   
	// TODAY AT MOD
	//
	if ( $board_config['time_today'] < $forum_data[$j]['post_time'])
	{
		$last_post .= sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']) . '&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;');
	}
		else if ( $board_config['time_yesterday'] < $forum_data[$j]['post_time'])
		{
			$last_post .= sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']) . '&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;');
		}
			else
		{
			$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> ';
   } 
Benutzeravatar
eXup
Mitglied
Beiträge: 78
Registriert: 03.05.2002 09:25
Kontaktdaten:

Beitrag von eXup »

Hi Henne23,

vielen Dank für den Code.

Funktioniert 1A!
Gruss vom eX
Benutzeravatar
Angela Goldig
Mitglied
Beiträge: 221
Registriert: 21.04.2003 04:10
Kontaktdaten:

Beitrag von Angela Goldig »

danke. ich hatte das gleiche problem :)
~blubb~
mikey

Beitrag von mikey »

ich auch. danke dafür.
Antworten

Zurück zu „phpBB 2.0: Administration, Benutzung und Betrieb“