[Mod Anpassung] Topic Description

Support zum phpBB2 und zu MODs anderer Autoren.

Moderator: Supporter

[Mod Anpassung] Topic Description

Beitragvon senyafin » 17. Dez 2006 20:45

Hallo AmigaLink, Hi all -

ich habe eine Mod eingebaut, die dem phpBB eine Topic Description hinzufügt. Leider habe ich mir vorher nicht die letzten Beiträge im phpBB.com Forum durchgelesen, sonst hätte ich es vermutlich gelassen.
Nun ist guter Rat teuer, denn die Mod funktioniert nicht.

Es gibt keine Fehlermeldung, allerdings passiert sonst auch nichts.
Nach dem Einbau kann man eine Topic Description angeben, angezeigt wird diese jedoch nicht.
Leider gibt es im phpBB.com keinen Support zu der Mod mehr, deshalb frage ich bei euch nach, vielleicht kann sich jemand denken, wo der Fehler herkommt.


Danke

http://www.phpbb.com/phpBB/viewtopic.php?t=148241

[center][- Codeblock vom Admin entfernt -][/center]
senyafin
User
 
Beiträge: 73
Registriert: 21. Nov 2006 08:52

Beitragvon AmigaLink » 18. Dez 2006 21:24

Wird die Beschreibung denn in der Datenbank gespeichert?
Und wird sie Angezeigt wenn du einen Beitrag editierst?
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Beitragvon senyafin » 19. Dez 2006 17:33

Erstmal sorry AmigaLink, ich habe versehentlich die falsche 'Topic Description' gepostet.

Hier ist die die ich meine

Code: Alles auswählen
###############################################
##   Hack Title:          Topic Description
##   Hack Version:        1.0.7
##   Author:              DTTVB (a.k.a. Mechakoopa Revolution) <mechakoopa@gmail.com>
##   Description:         Adds topic and post description feature.
##   Compatibility:       2.0.16 - 2.0.17
##
##   Installation Level:  Easy
##   Installation Time:   ~10 Minutes
##
##   Files To Edit: 6
##                includes/function_post.php
##                templates/subSilver/posting_body.tpl
##                templates/subSilver/viewforum_body.tpl
##                posting.php
##                viewforum.php
##                viewtopic.php
##
##   Included Files: N/A
##
##   History:
##      1.0.7:    Fixed: First post bug
##      1.0.6:    Fixed: Blank line bug
##      1.0.5:    MOD Version
##
##   Support:     http://www.phpbbhacks.com/forums
##
##   Copyright:   Copyright (C) 2005 Topic Description 1.0.6 - DTTVB
###############################################
##
## Author Notes:
##    I gonna make the phpBB have some IPB features.
##    You can translate these textz, because this MOD is hard to make,
##    so it will be only available in English, if you want to translate it,
##    just edit these lines.
##    1: <td class="row1" width="22%"><span class="gen"><b>Topic Description</b></span></td>
##                                                         ################# <- Translate This
##    2: 'POST_SUBJECT' => $post_subject . "<br />Description: " . htmlspecialchars($postrow[$i]['post_description']),
##                                                ########### <- Translate This.
##
###############################################
##   Always back up all files related to this hack before use!
###############################################
##   You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
##   Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##   Please visit http://www.phpbbhacks.com/ for updates of this hack.
###############################################
##   This hack is released under the GPL License.
##   This hack can be freely used, but not distributed, without permission.
###############################################
##   You can always contact me via e-mail if you have any questions, suggestions.
##   My e-mail is mechakoopa@gmail.com
###############################################

#
#-----[ SQL ]----------------------------------------
#
ALTER TABLE [Prefix]topics ADD topic_description VARCHAR( 100 ) NOT NULL ;

#
#-----[ SQL ]----------------------------------------
#
ALTER TABLE [Prefix]posts_text ADD post_description VARCHAR( 100 ) NOT NULL ;

#
#-----[ OPEN ]---------------------------------------
#
templates/subSilver/posting_body.tpl

#
#-----[ FIND ]---------------------------------------
#
   <tr>
     <td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td>
     <td class="row2" width="78%"> <span class="gen">
      <input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />
      </span> </td>
   </tr>

#
#-----[ AFTER, ADD ]---------------------------------
#
   <tr>
     <td class="row1" width="22%"><span class="gen"><b>Topic Description</b></span></td>
     <td class="row2" width="78%"> <span class="gen">
      <input type="text" name="topicdesc" size="45" maxlength="100" style="width:450px" tabindex="2" class="post" value="{T_DESC}" />
      </span> </td>
   </tr>

#
#-----[ OPEN ]---------------------------------------
#
posting.php

#
#-----[ FIND ]---------------------------------------
#
         $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : '';

#
#-----[ AFTER, ADD ]---------------------------------
#
         $topic_desc = ( !empty($HTTP_POST_VARS['topicdesc']) ) ? trim($HTTP_POST_VARS['topicdesc']) : '';

#
#-----[ FIND ]---------------------------------------
#
            submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);

#
#-----[ REPLACE WITH ]-------------------------------
#
            submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length, $topic_desc);

#
#-----[ FIND ]---------------------------------------
#
      $select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig" : '';

#
#-----[ REPLACE WITH ]-------------------------------
#
      $select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, t.topic_description, pt.post_description" : '';

#
#-----[ FIND ]---------------------------------------
#
      $subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject'];

#
#-----[ AFTER, ADD ]---------------------------------
#
      $topic_desc = ( $post_data['first_post'] ) ? $post_info['topic_description'] : $post_info['post_description'];

#
#-----[ FIND ]---------------------------------------
#
   $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['subject']))) : '';

#
#-----[ AFTER, ADD ]---------------------------------
#
   $topic_desc = ( !empty($HTTP_POST_VARS['topicdesc']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['topicdesc']))) : '';

#
#-----[ FIND ]---------------------------------------
#
   'SUBJECT' => $subject

#
#-----[ AFTER, ADD ]---------------------------------
#
   'T_DESC' => $topic_desc,


#
#-----[ OPEN ]---------------------------------------
#
includes/function_post.php

#
#-----[ FIND ]---------------------------------------
#
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)

#
#-----[ REPLACE WITH ]-------------------------------
#
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length, &$t_desc)

#
#-----[ FIND ]---------------------------------------
#
      $sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . " WHERE topic_id = $topic_id";

#
#-----[ REPLACE WITH ]-------------------------------
#
      $sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote, topic_description) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote, '$t_desc')" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", topic_description = '$t_desc' WHERE topic_id = $topic_id";

#
#-----[ FIND ]---------------------------------------
#
   $sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";

#
#-----[ REPLACE WITH ]-------------------------------
#
   $sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text, post_description) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message', '$t_desc')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject', post_description = '$t_desc' WHERE post_id = $post_id";

#
#-----[ OPEN ]---------------------------------------
#
viewforum.php

#
#-----[ FIND ]---------------------------------------
#
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username

#
#-----[ REPLACE WITH ]-------------------------------
#
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, t.topic_description

#
#-----[ FIND ]---------------------------------------
#
      $template->assign_block_vars('topicrow', array(

#
#-----[ AFTER, ADD ]---------------------------------
#
         'TOPIC_DESCRIPTION' => (trim(htmlspecialchars($topic_rowset[$i]['topic_description'])) != "") ? htmlspecialchars($topic_rowset[$i]['topic_description']) . "<br>" : "",

#
#-----[ OPEN ]---------------------------------------
#
templates/subSilver/viewforum_body.tpl

#
#-----[ FIND ]---------------------------------------
#
     <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />

#
#-----[ AFTER, ADD ]---------------------------------
#
     {topicrow.TOPIC_DESCRIPTION}

#
#-----[ OPEN ]---------------------------------------
#
viewtopic.php

#
#-----[ FIND ]---------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid

#
#-----[ REPLACE WITH ]-------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid, pt.post_description

#
#-----[ FIND ]---------------------------------------
#
      'POST_SUBJECT' => $post_subject,

#
#-----[ REPLACE WITH ]-------------------------------
#
      'POST_SUBJECT' => $post_subject . "<br />Description: " . htmlspecialchars($postrow[$i]['post_description']),

#
#-----[ SAVE & CLOSE ALL FILES ]---------------------
#
# End of hack.


Und um deinen Fragen zu beantworten,
Nein die werden nicht in der Datenbank gespeichert und auch nicht angezeigt, wenn ein Beitrag editiert wird.
Ich bin grad nochmal den gesamten code durchgegangen und glaube der Fehler liegt in einer Passage des Codes in der function_post.php

Dieser sieht bei mir derzeit so aus.
Code: Alles auswählen
$sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote,k_id) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote, $k_id)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", k_id=$k_id WHERE topic_id = $topic_id";


Und soll so angepasst werden.

Code: Alles auswählen
$sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote, k_id, topic_description) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote, '$t_desc', $k_id)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", k_id=$k_id WHERE topic_id = $topic_id";


Ich glaube die Where Klausel ist bei mir falsch gesetzt.
Ich weiss nämlich nicht wie ich den alten Wert mit dem neuen ersetzen muss bzw. wie genau der String auszusehen hat damit auch der andere Parameter nachher korrekt verarbeitet wird.


Hier mein "Vorschlag"

Code: Alles auswählen
$sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote,k_id) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote, $k_id)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", k_id=$k_id, topic_description = '$t_desc' WHERE topic_id = $topic_id";


Zugefügt nach 25 Minute(n):

Das ist strange - :P

jetzt funktioniert es :!:

Zugefügt nach weiteren 15 Minute(n):

OK,

so langsam wirds ;-)


@AmigaLink, vielleicht kannst du mir zur Thematik noch einen Tip geben.
Und zwar finde ich es nicht so toll, dass die Topic Description in BOLD dargestellt wird.
Code: Alles auswählen
'POST_SUBJECT' => $post_subject . "<br />&nbsp;&nbsp;&nbsp;&nbsp;Description: " . htmlspecialchars($postrow[$i]['post_description']),


Wie kann ich das machen, dass Subject und Description mit einem dünnen Balken voneinander getrennt sind. Zum anderen würde ich gern die Description in Schriftgröße 8 und in einer anderen Farbe darstellen.
senyafin
User
 
Beiträge: 73
Registriert: 21. Nov 2006 08:52

Beitragvon AmigaLink » 19. Dez 2006 20:27

Bitte Poste nicht so große Codeblöcke (schon gar nicht wenn es komplette MODs sind), sondern häng sie besser als Attachment an.

Wie kann ich das machen, dass Subject und Description mit einem dünnen Balken voneinander getrennt sind. Zum anderen würde ich gern die Description in Schriftgröße 8 und in einer anderen Farbe darstellen.

Eine Lösung ware:
Code: Alles auswählen
'POST_SUBJECT' => $post_subject . '<hr />&nbsp;<span style="color:#968E8A; font-size:8px">' . htmlspecialchars($postrow[$i]['post_description']) . '</span>',


Eleganter wäre es allerdings, wenn man die Formatierung dem verwendetem Template überlässt.
Dafür einfach nur einen zusätzlichen Platzhalter mit der unformatierten Beschreibung definieren
Code: Alles auswählen
'POST_DESCRIPTION' => htmlspecialchars($postrow[$i]['post_description']),
der dann beliebig in der viewtopic_body.tpl platziert
Code: Alles auswählen
{postrow.POST_DESCRIPTION}
und somit dort mittels HTML Formatiert werden kann.
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Beitragvon senyafin » 19. Dez 2006 21:33

AmigaLink hat geschrieben:Bitte Poste nicht so große Codeblöcke (schon gar nicht wenn es komplette MODs sind), sondern häng sie besser als Attachment an.


Alles klar, mache ich zukünftig.

Danke für die Tipps.
Der erste funktioniert tadellos. Kannst du mir da bitte noch sagen, wie ich die horizontale Line formatieren kann. Das wäre nett.

Ich hätte die von dir vorgeschlagene zweite Variante gerne genutzt, aber wenn ich den Code so einbaue, wird mir die Topic Beschreibung nicht angezeigt.

in der viewtopic.php sieht der Code so aus.
Code: Alles auswählen
      
'POST_SUBJECT' => $post_subject,
'POST_DESCRIPTION' => htmlspecialchars($postrow[$i]['post_description']),


hier noch der Code des viewforum_body.template


Code: Alles auswählen
<!-- BEGIN topicrow -->
<tr>
   <td class="{topicrow.ROW_COLOR_TOPIC_TYPE1}" align="center" valign="middle" width="18"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="15" height="15" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>
   <td class="{topicrow.ROW_COLOR_TOPIC_TYPE1}" width="100%" onclick="window.location.href='{topicrow.U_VIEW_TOPIC}'">
      <span class="topiclink{topicrow.XS_NEW}">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_ATTACHMENT_IMG}{topicrow.TOPIC_TYPE}{topicrow.TOPIC_KAT}<a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}&nbsp;<br />{postrow.POST_DESCRIPTION}</a>
      
      <span class="gotopage">{topicrow.GOTO_PAGE}</span>


Was ich nicht verstehe, was das viewforum template damit zu tun hat.
Müsste diese nicht im viewtopic_template vorgenommen werden ?

Obwohl du ja schreibst, dass das der code ins viewtopic_template gehört...
Hat sich der Typ beim schreiben der Mod -Install wohl vertan
senyafin
User
 
Beiträge: 73
Registriert: 21. Nov 2006 08:52

Beitragvon AmigaLink » 19. Dez 2006 22:11

viewtopic.php gehört zu viewtopic_body.tpl und viewforum.php gehört zu viewforum_body.tpl.

Das bedeutet wenn du meinem 2'ten Vorschlag (für die viewtopic.php) nimmst, dann muss {postrow.POST_DESCRIPTION} natürlich (wie ich geschrieben habe) in die viewtopic_body.tpl und nicht (wie du gemacht hast) un die viewforum_body.tpl. ;)

Und was das Formatieren der Linie anbetrifft: selfHTML :)
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Beitragvon senyafin » 19. Dez 2006 22:16

yep, hab es inzwischen hinbekommen.
Vielen Dank für die Hilfe.

Und das wegen dem vieforum_body template hatte ich aus der Install genommen. So wie es da beschrieben war, ging es einmal um die viewtopic.pho und zum anderen um das viewforum_template.

Egal - das Problem wäre gelöst und es gibt einen Bug weniger.
Schönen Abend dir noch.
senyafin
User
 
Beiträge: 73
Registriert: 21. Nov 2006 08:52

Beitragvon AmigaLink » 19. Dez 2006 22:19

Schönen Abend dir noch.

Danke, dir auch. :)
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW


Zurück zu phpBB2 Support



Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 14 Gäste

cron