Mouse-hover-topic-preview-MOD ändern .

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
Benutzeravatar
Nina3Jungs
Beiträge: 112
Registriert: Sa 10.Jul, 2004 14:17
Kontaktdaten:

Mouse-hover-topic-preview-MOD ändern .

Beitrag von Nina3Jungs »

Ich würde gerne den Mousew_hover_topic_preview MOD dahingehend ändern, dass
nicht der Text der letzten Antwort sondern der Test des Startpostings angezeigt wird.

Hier mal die Installationsanleitung zu dem MOD (dankenswerterweise von Pete®
für Plus 1.52 angepasst):

Code: Alles auswählen

################################################################# 
## Mod Title: Mouse hover topic preview 4 phpbbPlus 1.52 
## Mod Version: 1.0.0 
## Original Author: Sven Ansem <sven@shannado.nl> - http://www.shannado.nl 
## Author: Pete® <p.s16@web.de> - http://pete.dsl-inet.com/ 
## Description: With this MOD an user can see preview, when he/she holds the mouse over the topic in viewforum 
##      It showes the first 200 characters of the LAST post. 
##      
## 
## Installation Level: Easy 
## Installation Time: 5 Minutes 
## Files To Edit: viewforum.php, viewforum_body.tpl, bbcode.php 
## Included Files: N/A 
################################################################# 
## 
## Author Note: 
##      !I USED THE MOD FROM <SVEN ANSEM> AND MODIFIED FOR phpBB Plus 1.52!THE IDEA IS HIS WORK, MOST CODE ALSO IS HIS WORK! 
## 
##   I have set a limit (200) on the number of characters show in the preview. You can adjust is yourself to anynumber. 
##   Replace the '200' with your number. In the following code lines: 
##      $topic_content = $topic_rowset[$i]['post_text']; 
## 
##      if (strlen($topic_content) > 200) 
##      { 
##         $topic_content = substr($topic_content, 0, 200) . "..."; 
##      } 
##      else 
##      { 
##         $topic_content = $topic_content; 
##      } 
## 
## 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 

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

viewforum.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

include($phpbb_root_path . 'common.'.$phpEx); 

# 
#-----[ FIND ]------------------------------------------ 
# 

// 
// All announcement data, this keeps announcements 
// on each viewforum page ... 
// 
$sql = ... 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
#!!! I MEAN REPLACE THE SQL!!! 
// 
// All announcement data, this keeps announcements 
// on each viewforum page ... 
// 
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, pt.post_text, pt.bbcode_uid 
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt 
   WHERE (t.forum_id = $forum_id" . ( (intval($board_config['announcement_display_forum']) == 0) ? " OR t.topic_type = " . POST_GLOBAL_ANNOUNCE : '' ) . ") 
      AND t.topic_poster = u.user_id 
      AND p.post_id = pt.post_id 
      AND p.post_id = t.topic_last_post_id 
      AND p.poster_id = u2.user_id 
      AND (t.topic_type = " . POST_NEWS . " OR t.topic_type = " . POST_ANNOUNCE . " OR t.topic_type = " . POST_GLOBAL_ANNOUNCE . ") 
   ORDER BY t.topic_type <> " . POST_NEWS . " DESC, t.topic_type = " .POST_NEWS . ", t.topic_last_post_id DESC "; 

# 
#-----[ FIND ]------------------------------------------ 
# 
// 
// Grab all the basic data (all topics except announcements) 
// for this forum 
// 
//-- mod : announces ------------------------------------------------------------------------------- 
// here we added 
//   AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " 
//-- modify 

$sql = .... 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# I MEAN REPLACE THE SQL! 
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time,pt.post_text, pt.bbcode_uid 
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2, ". POSTS_TEXT_TABLE . " pt 
   WHERE t.forum_id = $forum_id 
      AND t.topic_poster = u.user_id 
      AND p.post_id = t.topic_first_post_id 
      AND p2.post_id = pt.post_id 
      AND p2.post_id = t.topic_last_post_id 
      AND u2.user_id = p2.poster_id 
      AND t.topic_type <> " . POST_NEWS . " 
      AND t.topic_type <> " . POST_ANNOUNCE . " 
      AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " 
      $limit_topics_time 
   ORDER BY t.topic_type DESC, t.topic_last_post_id DESC 
   LIMIT $start, ".$board_config['topics_per_page']; 

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

includes/functions_topics_list.php  

# 
#-----[ FIND ]------------------------------------------ 
# 
if ( !defined('IN_PHPBB') ) 
{ 
   die("Hacking attempt"); 
} 

# 
#-----[ AFTER ADD ]------------------------------------------ 
# 
// 
// Mouse hover topic preview MOD - BEGIN 
// 

function bbencode_strip_HOVER_MOD($message, $uid) 
{ 

   $message = strip_tags($message); 

   // url #2 
   $message = str_replace("[url]","", $message); 
   $message = str_replace("[/url]", "", $message); 

   // url /\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\](.*?)\[/url\]/si 
   $message = preg_replace("/\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\]/si", "", $message); 
   $message = str_replace("[/url:$uid]", "", $message); 

   $message = preg_replace("/\[.*?:$uid:?.*?\]/si", '', $message); 
   $message = preg_replace('/\[url\]|\[\/url\]/si', '', $message); 
   $message = str_replace('"', "'", $message); 
   return $message; 

} 

// 
// Mouse hover topic preview MOD - END 
// 
# 
#-----[ FIND ]------------------------------------------ 
# 

      $topic_title      = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title']; 

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

      $topic_content = $topic_rowset[$i]['post_text']; 
      $bbcode_uid = $topic_rowset[$i]['bbcode_uid']; 
      $topic_content = bbencode_strip_HOVER_MOD($topic_content, $bbcode_uid); 

      if (strlen($topic_content) > 200) 
      { 
         $topic_content = substr($topic_content, 0, 200) . "..."; 
      } 
      else 
      { 
         $topic_content = $topic_content; 
      } 


# 
#-----[ FIND ]------------------------------------------ 
# 

         'TOPIC_TITLE'         => $topic_title, 



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

         'TOPIC_CONTENT' => $topic_content, 

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

templates/fisubsilversh/topics_list_box.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 

<span class="topictitle">{topics_list_box.row.NEWEST_POST_IMG}{topics_list_box.row.TOPIC_ATTACHMENT_IMG} {topics_list_box.row.TOPIC_TYPE}<a href="{topics_list_box.row.U_VIEW_TOPIC}" class="topictitle">{topics_list_box.row.TOPIC_TITLE}</a></span><span class="gensmall"> 


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

<span class="topictitle">{topics_list_box.row.NEWEST_POST_IMG}{topics_list_box.row.TOPIC_ATTACHMENT_IMG} {topics_list_box.row.TOPIC_TYPE}<a href="{topics_list_box.row.U_VIEW_TOPIC}" class="topictitle" title="{topics_list_box.row.TOPIC_CONTENT}">{topics_list_box.row.TOPIC_TITLE}</a></span><span class="gensmall"> 


# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
Am liebsten auch noch mit Erklärung, warum ich was ändern muss. Ich möchte das
auch verstehen. ^b
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Finde in der viewforum.php

Code: Alles auswählen

$SQL = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time,pt.post_text, pt.bbcode_uid 
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2, ". POSTS_TEXT_TABLE . " pt 
      WHERE t.forum_id = $forum_id 
      AND t.topic_poster = u.user_id 
      AND p.post_id = t.topic_first_post_id 
      AND p2.post_id = pt.post_id 
und ersetze das mit

Code: Alles auswählen

$SQL = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time,pt.post_text, pt.bbcode_uid 
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2, ". POSTS_TEXT_TABLE . " pt 
      WHERE t.forum_id = $forum_id 
      AND t.topic_poster = u.user_id 
      AND p.post_id = t.topic_first_post_id 
      AND p.post_id = pt.post_id 
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Benutzeravatar
Nina3Jungs
Beiträge: 112
Registriert: Sa 10.Jul, 2004 14:17
Kontaktdaten:

Beitrag von Nina3Jungs »

Vielen Dank :-) Ändere ich gleich mal.
Benutzeravatar
Nina3Jungs
Beiträge: 112
Registriert: Sa 10.Jul, 2004 14:17
Kontaktdaten:

Beitrag von Nina3Jungs »

Hmm, funktioniert nicht. Ich seh danach nur noch die Ankündigungen in dem
Forum. Die restlichen Threads sind verschwunden :-/
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Ui, dann muss ich am WE mal selber testen...

EDIT:
Ich habe das mal eingebaut und mit folgendem Code sehe ich den jeweils ersten Beitrag:

Code: Alles auswählen

################################################################# 
## Mod Title: Mouse hover topic preview 4 phpbbPlus 1.52 
## Mod Version: 1.0.0 
## Original Author: Sven Ansem <sven@shannado.nl> - http://www.shannado.nl 
## Author: Pete® <p.s16@web.de> - http://pete.dsl-inet.com/ 
## Description: With this MOD an user can see preview, when he/she holds the mouse over the topic in viewforum 
##      It showes the first 200 characters of the LAST post. 
##      
## 
## Installation Level: Easy 
## Installation Time: 5 Minutes 
## Files To Edit: viewforum.php, viewforum_body.tpl, bbcode.php 
## Included Files: N/A 
################################################################# 
## 
## Author Note: 
##      !I USED THE MOD FROM <SVEN ANSEM> AND MODIFIED FOR phpBB Plus 1.52!THE IDEA IS HIS WORK, MOST CODE ALSO IS HIS WORK! 
## 
##   I have set a limit (200) on the number of characters show in the preview. You can adjust is yourself to anynumber. 
##   Replace the '200' with your number. In the following code lines: 
##      $topic_content = $topic_rowset[$i]['post_text']; 
## 
##      if (strlen($topic_content) > 200) 
##      { 
##         $topic_content = substr($topic_content, 0, 200) . "..."; 
##      } 
##      else 
##      { 
##         $topic_content = $topic_content; 
##      } 
## 
## 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 

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

viewforum.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

include($phpbb_root_path . 'common.'.$phpEx); 

# 
#-----[ FIND ]------------------------------------------ 
# 

// 
// All announcement data, this keeps announcements 
// on each viewforum page ... 
// 
$sql = ... 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
#!!! I MEAN REPLACE THE SQL!!! 
// 
// All announcement data, this keeps announcements 
// on each viewforum page ... 
// 
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, pt.post_text, pt.bbcode_uid 
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt 
   WHERE (t.forum_id = $forum_id" . ( (intval($board_config['announcement_display_forum']) == 0) ? " OR t.topic_type = " . POST_GLOBAL_ANNOUNCE : '' ) . ") 
      AND t.topic_poster = u.user_id 
      AND t.topic_first_post_id = pt.post_id 
      AND p.post_id = t.topic_last_post_id 
      AND p.poster_id = u2.user_id 
      AND (t.topic_type = " . POST_NEWS . " OR t.topic_type = " . POST_ANNOUNCE . " OR t.topic_type = " . POST_GLOBAL_ANNOUNCE . ") 
   ORDER BY t.topic_type <> " . POST_NEWS . " DESC, t.topic_type = " .POST_NEWS . ", t.topic_last_post_id DESC "; 

# 
#-----[ FIND ]------------------------------------------ 
# 
// 
// Grab all the basic data (all topics except announcements) 
// for this forum 
// 
//-- mod : announces ------------------------------------------------------------------------------- 
// here we added 
//   AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " 
//-- modify 

$sql = .... 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# I MEAN REPLACE THE SQL! 
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time,pt.post_text, pt.bbcode_uid 
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2, ". POSTS_TEXT_TABLE . " pt 
   WHERE t.forum_id = $forum_id 
      AND t.topic_poster = u.user_id 
      AND p.post_id = t.topic_first_post_id 
      AND t.topic_first_post_id = pt.post_id 
      AND p2.post_id = t.topic_last_post_id 
      AND u2.user_id = p2.poster_id 
      AND t.topic_type <> " . POST_NEWS . " 
      AND t.topic_type <> " . POST_ANNOUNCE . " 
      AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " 
      $limit_topics_time 
   ORDER BY t.topic_type DESC, t.topic_last_post_id DESC 
   LIMIT $start, ".$board_config['topics_per_page']; 

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

includes/functions_topics_list.php  

# 
#-----[ FIND ]------------------------------------------ 
# 
if ( !defined('IN_PHPBB') ) 
{ 
   die("Hacking attempt"); 
} 

# 
#-----[ AFTER ADD ]------------------------------------------ 
# 
// 
// Mouse hover topic preview MOD - BEGIN 
// 

function bbencode_strip_HOVER_MOD($message, $uid) 
{ 

   $message = strip_tags($message); 

   // url #2 
   $message = str_replace("[url]","", $message); 
   $message = str_replace("[/url]", "", $message); 

   // url /\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\](.*?)\[/url\]/si 
   $message = preg_replace("/\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\]/si", "", $message); 
   $message = str_replace("[/url:$uid]", "", $message); 

   $message = preg_replace("/\[.*?:$uid:?.*?\]/si", '', $message); 
   $message = preg_replace('/\[url\]|\[\/url\]/si', '', $message); 
   $message = str_replace('"', "'", $message); 
   return $message; 

} 

// 
// Mouse hover topic preview MOD - END 
// 
# 
#-----[ FIND ]------------------------------------------ 
# 

      $topic_title      = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title']; 

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

      $topic_content = $topic_rowset[$i]['post_text']; 
      $bbcode_uid = $topic_rowset[$i]['bbcode_uid']; 
      $topic_content = bbencode_strip_HOVER_MOD($topic_content, $bbcode_uid); 

      if (strlen($topic_content) > 200) 
      { 
         $topic_content = substr($topic_content, 0, 200) . "..."; 
      } 
      else 
      { 
         $topic_content = $topic_content; 
      } 


# 
#-----[ FIND ]------------------------------------------ 
# 

         'TOPIC_TITLE'         => $topic_title, 



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

         'TOPIC_CONTENT' => $topic_content, 

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

templates/fisubsilversh/topics_list_box.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 

<span class="topictitle">{topics_list_box.row.NEWEST_POST_IMG}{topics_list_box.row.TOPIC_ATTACHMENT_IMG} {topics_list_box.row.TOPIC_TYPE}<a href="{topics_list_box.row.U_VIEW_TOPIC}" class="topictitle">{topics_list_box.row.TOPIC_TITLE}</a></span><span class="gensmall"> 


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

<span class="topictitle">{topics_list_box.row.NEWEST_POST_IMG}{topics_list_box.row.TOPIC_ATTACHMENT_IMG} {topics_list_box.row.TOPIC_TYPE}<a href="{topics_list_box.row.U_VIEW_TOPIC}" class="topictitle" title="{topics_list_box.row.TOPIC_CONTENT}">{topics_list_box.row.TOPIC_TITLE}</a></span><span class="gensmall"> 


# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
Dabei sind eigentlich nur die beiden grossen SQL-Abfragen wichtig, wenn Du den Mod soweit schon eingebaut hast.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Antworten