Seite 1 von 1

Nachrichtentext in vieforum.php anzeigen, wenn Announcement

Verfasst: 19.05.2004 14:19
von komeo
Hi,
ich möchte in der viewforum.php außer dem Titel auch den Nachrichtentext
anzeigen, wenn die Nachricht ein Annoucement ist. Leider konnte ich keinen
Mod oder eine Anleitung dazu finden und zum selbst programmieren reichen
meine PHP-Kenntnisse nicht.

So soll es aussehen:

[ externes Bild ]

Bin dankbar für jede Hilfe.

Verfasst: 19.05.2004 14:23
von Mario Siebert
Zeig mal deine viewforum.php/viewforum_body.tpl als *.txt

Mario

viewforum_body.tpl

Verfasst: 19.05.2004 14:30
von komeo
Habe Attachmod und Alexis Style und einige eigene Veränderungen.

Code: Alles auswählen

<form method="post" action="{S_POST_DAYS_ACTION}">
  <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
	<tr> 
	  <td align="left" valign="bottom" width="50"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a></td>
	  <td align="left" valign="bottom" class="nav" width="100%"><span class="nav"> <a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></span></td>
	  <td align="right" valign="bottom" class="nav" nowrap="nowrap"><span class="gensmall"><a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a></span></td>
	</tr>
  </table>

  <table border="0" cellpadding="4" cellspacing="1" width="100%" class="forumborder">
	<tr> 
	  <th width="100" align="center" class="forumtitle" nowrap="nowrap"> {L_AUTHOR} </th>
	  <th colspan="2" align="center" height="20" class="forumtitle" nowrap="nowrap"> {L_TOPICS} </th>
	  <th width="50" align="center" class="forumtitle" nowrap="nowrap"> {L_REPLIES} </th>
	  <th width="50" align="center" class="forumtitle" nowrap="nowrap"> {L_VIEWS} </th>
	  <th align="center" class="forumtitle" nowrap="nowrap"> {L_LASTPOST} </th>
	</tr>
	<!-- BEGIN topicrow -->
	<tr> 
	  <td class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
	  <td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>
	  <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_ATTACHMENT_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />
		{topicrow.GOTO_PAGE}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.REPLIES}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.VIEWS}</span></td>
	  <td class="row3" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
	</tr>
	<!-- END topicrow -->
	<!-- BEGIN switch_no_topics -->
	<tr> 
	  <td class="row1" colspan="6" height="30" align="center" valign="middle"><span class="gen">{L_NO_TOPICS}</span></td>
	</tr>
	<!-- END switch_no_topics -->
	<tr> 
	  <td class="catBottom" align="right" valign="middle" colspan="6" height="28"><span class="genmed">{L_DISPLAY_TOPICS}: {S_SELECT_TOPIC_DAYS}  
		<input type="submit" class="liteoption" value="{L_GO}" name="submit" />
		</span></td>
	</tr>
  </table>

  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
	<tr> 
	  <td align="left" valign="middle" width="50"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a></td>
	  <td align="right"><span class="nav">{PAGE_NUMBER}</span></td>
	</tr>
  </table>
</form>

<!-- RP <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
	<td align="right">{JUMPBOX}</td>
  </tr>
</table> -->


viewforum.php

Verfasst: 19.05.2004 14:34
von komeo

Verfasst: 19.05.2004 14:56
von Mario Siebert
viewforum.php:

[suchen]

Code: Alles auswählen

$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
	WHERE t.forum_id = $forum_id 
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_last_post_id
		AND p.poster_id = u2.user_id
		AND t.topic_type = " . POST_ANNOUNCE . " 
	ORDER BY t.topic_last_post_id DESC ";
[ersetzen durch]

Code: Alles auswählen

$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
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
         LEFT JOIN " . POSTS_TEXT_TABLE . " pt ON pt.post_id = t.topic_first_post_id
	WHERE t.forum_id = $forum_id
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_last_post_id
		AND p.poster_id = u2.user_id
		AND t.topic_type = " . POST_ANNOUNCE . "
	ORDER BY t.topic_last_post_id DESC ";
[suchen]

Code: Alles auswählen

$template->assign_block_vars('topicrow', array(
			'ROW_COLOR' => $row_color,
			'ROW_CLASS' => $row_class,
			'FORUM_ID' => $forum_id,
			'TOPIC_ID' => $topic_id,
			'TOPIC_FOLDER_IMG' => $folder_image,
			'TOPIC_AUTHOR' => $topic_author,
			'GOTO_PAGE' => $goto_page,
			'REPLIES' => $replies,
			'NEWEST_POST_IMG' => $newest_post_img,
			'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']),
			'TOPIC_TITLE' => $topic_title,
[danach einfügen]

Code: Alles auswählen

'TOPIC_TEXT' => $topic_rowset[$i]['post_text'],

viewforum_body.tpl

[suchen]

Code: Alles auswählen

<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall">
[ersetzen durch]

Code: Alles auswählen

<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />{topicrow.TOPIC_TEXT}
Mario

Herrlich

Verfasst: 19.05.2004 15:43
von komeo
Funktioniert hervorragend.

Es werden aber die Returns im Nachrichtentext wie in
viewtopic nicht angezeigt und ich möchte den Besuchern
kein <br> zumuten. Hast Du dafür noch einen Tip?

Auf jeden Fall schon einmal tausend Dank.
Ralf

Re: Herrlich

Verfasst: 19.05.2004 16:40
von Mario Siebert
komeo hat geschrieben:Funktioniert hervorragend.

Es werden aber die Returns im Nachrichtentext wie in
viewtopic nicht angezeigt und ich möchte den Besuchern
kein <br> zumuten. Hast Du dafür noch einen Tip?
Sicher.

viewforum.php

[suchen]

Code: Alles auswählen

$template->assign_block_vars('topicrow', array(
[davor einfügen]

Code: Alles auswählen

$topic_rowset[$i]['post_text'] = str_replace("\n", "\n<br />\n", $topic_rowset[$i]['post_text']);
Mario