Seite 1 von 1

ezPortal mit Kommentaren?

Verfasst: 14.05.2003 19:07
von neo18tilidie PW vergessen
Einige nutzen bestimmt das ezPortal System.
Eine kleine Funktion würd mir bei dem Ding noch gefallen:
Die letzten 5 Kommentare sollten ohne Avatar und sonstigen Schnick-Schnack bei "Read Full" unter dem Arikel angezeigt werden.

Bestimmt nicht schwer zu realisieren. Werde mich auch mal dran versuchen, wenn nicht zeit habe... aber vielleicht hat ja schon jemand sowas in der Art gebastelt, gesehn oder will's selber Coden?

MfG & THX

P.S.: :cookie: schöner smilie :roll:

Comments im ezPortal

Verfasst: 18.05.2003 16:25
von neo18tilidie
no reply...

selbst ist der mann... :-?

Was macht das Mod?
Zeigt bei "Read Full" Kommentare zum Artikel an, wenn welche vorhanden sind. Anzahl ist unbegrenzt. Dargstellt werden die comments ohne Avatar und sonstigen Schnick-Schnack

Demo: http://www.party-cam.org/board/home.php?article=1

Benötigt wird das ezPortal Mod & das Quick Reply Hack.
Ist alles bisschen rumgepfuscht und durcheinander aber läuft...
Der Code ist für Profile mit Birthday & Gender Mod. Wer das nicht drin hat muss einfach alles mit "gender" und "birthday" rauslöschen...
:)

Installation:

Code: Alles auswählen

***************** FINDE in portal.php *****************

else

{

	$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], 0);



	$i = intval($HTTP_GET_VARS['article']);


***************** DANACH EINFÜGEN *****************


//
// Go ahead and pull all data for this topic
//

$sql = "SELECT u.*, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid
	FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
	WHERE p.topic_id = ".$fetchposts[$i]['topic_id']."

		AND pt.post_id = p.post_id
		AND u.user_id = p.poster_id
		ORDER BY p.post_time ";

		if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}

$number_comments = $db->sql_numrows($result);
$comment_row = array();

if ( $fetchposts[$i]['topic_replies'] < 1  )

{ 	$template->assign_block_vars('comment_row', array(
		'NO_COMMENTS' => '<tr><td colspan=3><center><span class=genmed><b>Es wurden bisjetz keine Kommentare abgegeben</b></span></center></td></tr>'
		)
	);
}

if ( $fetchposts[$i]['topic_replies'] > 0  )

{ 	$template->assign_block_vars('comment_row', array(
		'NO_COMMENTS' => '<tr><th colspan=3><center><span class=genmed>Kommentare</span></center></th></tr>'
		)
	);
}



while ($row = $db->sql_fetchrow($result))
{
	$comment_row[] = $row;
}
for ($j = 1; $j < $number_comments; $j++)
{


			stripslashes($comment_row[$j]['post_text']);
			if (($strip_text == 0) or (strlen($comment_row[$j]['post_text']) <= $strip_text))
			{
				$comment_row[$j]['post_text'] = bbencode_second_pass($comment_row[$j]['post_text'], $comment_row[$j]['bbcode_uid']);
			}
			else 
			{
				$comment_row[$j]['post_text'] = bbencode_strip($comment_row[$j]['post_text'], $comment_row[$j]['bbcode_uid']);
				$comment_row[$j]['post_text'] = substr($comment_row[$j]['post_text'], 0, $strip_text) . '...';
			}

			if ($comment_row[$j]['enable_smilies'] == 1)
			{
				$comment_row[$j]['post_text'] = smilies_pass($comment_row[$j]['post_text']);
			}
			$comment_row[$j]['post_text'] = make_clickable($comment_row[$j]['post_text']);

			$orig_word = array();
			$replacement_word = array();
			obtain_word_list($orig_word, $replacement_word);

			if (count($orig_word))
			{
				$comment_row[$j]['topic_title'] = preg_replace($orig_word, $replacement_word, $comment_row[$j]['topic_title']);
				$comment_row[$j]['post_text'] = preg_replace($orig_word, $replacement_word, 	$comment_row[$j]['post_text']);
			}
			$comment_row[$j]['post_text'] = nl2br($comment_row[$j]['post_text']);


	if ( $comment_row[$j]['user_birthday'] != 999999 )
	{
	   $poster_age =realdate('Y',(time()/86400))- realdate ('Y',$comment_row[$j]['user_birthday']);
	   if (date('md')<realdate('md',$comment_row[$j]['user_birthday'])) $poster_age--;
	   $poster_age = '(' . $poster_age . ')';
	} else $poster_age = ' ';


		if ( !empty($comment_row[$j]['user_gender']))
		   {
		      switch ($comment_row[$j]['user_gender'])
		      {
		         case 1 : $gender_image = "<img src=\"" . $images['icon_minigender_male'] . "\" alt=\"" . $lang['Gender']. ":".$lang['Male']. "\" title=\"" . $lang['Gender'] . ":".$lang['Male']. "\" border=\"0\" hspace=\"3\" />"; break;
		         case 2 : $gender_image = "<img src=\"" . $images['icon_minigender_female'] . "\" alt=\"" . $lang['Gender']. ":".$lang['Female']. "\" title=\"" . $lang['Gender'] . ":".$lang['Female']. "\" border=\"0\" hspace=\"3\" />"; break;
		         default : $gender_image="";
		      }
   }

	$poster_from = ( $comment_row[$j]['user_from'] && $comment_row[$j]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $comment_row[$j]['user_from'] : '';


	$template->assign_block_vars('comment_row', array(
		'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $recent_topic_row[$j]['topic_id']),
		'COMMENT_TITLE' => $comment_row[$j]['topic_title'],
		'COMMENT_TEXT' => $comment_row[$j]['post_text'],
		'USER_ID' => $comment_row[$j]['user_id'],
		'POSTER_FROM' => $poster_from,
		'USERNAME' => $comment_row[$j]['username'],
		'POSTER_GENDER' => $gender_image,
		'POSTER_AGE' => $poster_age
		)
	);
}


$topic_id = $fetchposts[$i]['topic_id'];



***************** FINDE in portal.php *****************


//
// Generate the page
//

$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);


***************** DANACH EINFÜGEN *****************


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


***************** FINDE in portal_body.tpl *****************


		<!-- END fetch_post_row -->


***************** DANACH EINFÜGEN *****************


<br><p><br><p>
<table border=0 width="100%" cellpadding=0 cellspacing=0>
		<!-- BEGIN comment_row -->
{comment_row.NO_COMMENTS}
<tr><td colspan="3">
<table width=100% border=0 class=forumline cellpadding=4 cellspacing=1>
<tr><td class=row2 valign=top width=20%>
<span class=genmed> <a href="profile.php?mode=viewprofile&u={comment_row.USER_ID}"><b>{comment_row.USERNAME} {comment_row.POSTER_AGE}</b></a><p></span>
<span class=gensmall>{comment_row.POSTER_FROM}</td>
<td class=row1 valign=top><span class=genmed>{comment_row.COMMENT_TEXT}</td></tr>
</table></td></tr>
	<tr>
		<td class="spaceRow" colspan="3" height="5"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="5" /></td>
	</tr>
		<!-- END comment_row -->
</table>
<table width=100% border=0 class=forumline cellpadding=4 cellspacing=1>
<!-- BEGIN quick_reply -->
<script language='JavaScript'>
	function openAllSmiles(){
		smiles = window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=400,resizable=yes,scrollbars=yes,WIDTH=650');
		smiles.focus();
		return false;
	}
	
	function quoteSelection() {

		theSelection = false;
		theSelection = document.selection.createRange().text; // Get text selection

		if (theSelection) {
			// Add tags around selection
			emoticon( '[quote]\n' + theSelection + '\n[/quote]\n');
			document.post.message.focus();
			theSelection = '';
			return;
		}else{
			alert('{L_NO_TEXT_SELECTED}');
		}
	}

	function storeCaret(textEl) {
		if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
	}

	function emoticon(text) {
		if (document.post.message.createTextRange && document.post.message.caretPos) {
			var caretPos = document.post.message.caretPos;
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
			document.post.message.focus();
		} else {
			document.post.message.value  += text;
			document.post.message.focus();
		}
	}

	function checkForm() {
		formErrors = false;
		if (document.post.message.value.length < 2) {
			formErrors = '{L_EMPTY_MESSAGE}';
		}
		if (formErrors) {
			alert(formErrors);
			return false;
		} else {
			if (document.post.quick_quote.checked) {
				document.post.message.value = document.post.last_msg.value + document.post.message.value;
			} 
			document.post.quick_quote.checked = false;
			return true;
		}
	}
</script>
<form action='{quick_reply.POST_ACTION}' method='post' name='post' onsubmit='return checkForm(this)'>
<input type="hidden" name="sid" value="{quick_reply.SID}">  
<tr>

<td class=row1><b>{L_QUICK_REPLY}</b></td>
<td class=row1><b>Smilies</b></td>

</tr>
<!-- BEGIN user_logged_out -->
<!-- END user_logged_out -->

<input type='hidden' name='quick_quote'>
<!-- BEGIN user_logged_in -->
<input type='hidden' name='attach_sig' {quick_reply.user_logged_in.ATTACH_SIGNATURE}>
<input type='hidden' name='notify' {quick_reply.user_logged_in.NOTIFY_ON_REPLY}>
<!-- END user_logged_in -->

<input type='hidden' name='mode' value='reply'>
<input type='hidden' name='t' value='{quick_reply.TOPIC_ID}'>
<input type='hidden' name='last_msg' value='{quick_reply.LAST_MESSAGE}'>
<!--input type='hidden' name='message' value=''-->
<td bgcolor="#111c47" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#111c47" valign='top'>
<textarea name='message' rows="6" cols="35" style="width:470px" wrap='virtual' tabindex='1' class='post2' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea><br>
<INPUT TYPE='button' name='smiles_all' class='liteoption' VALUE='Mehr Smilies' ONCLICK="openAllSmiles();">&nbsp;
<input type='button' name='quoteselected' class='liteoption' value='{L_QUOTE_SELECTED}' onclick='javascript:quoteSelection()'>&nbsp;
<input type='submit' name='preview' class='liteoption' value='{L_PREVIEW}'>&nbsp;
<input type='submit' name='post' class='mainoption' value='{L_SUBMIT}' accesskey="s">
</td>
</tr>
</table>
</td>
<td bgcolor="#111c47" valign='top'>
			  <table width="100" border="0" cellspacing="0" cellpadding="5">
				<tr align="center" valign="middle">
				  <td><img src="images/smiles/icon_biggrin.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':D');" alt="Very Happy" title="Very Happy" /></td>
				  <td><img src="images/smiles/icon_smile.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':)');" alt="Smile" title="Smile" /></td>
				  <td><img src="images/smiles/icon_sad.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':(');" alt="Sad" title="Sad" /></td>
				  <td><img src="images/smiles/icon_surprised.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':o');" alt="Surprised" title="Surprised" /></td>
				</tr>
				<tr align="center" valign="middle">
				  <td><img src="images/smiles/icon_eek.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':shock:');" alt="Shocked" title="Shocked" /></td>
				  <td><img src="images/smiles/icon_confused.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':?');" alt="Confused" title="Confused" /></td>
				  <td><img src="images/smiles/icon_cool.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('8)');" alt="Cool" title="Cool" /></td>
				  <td><img src="images/smiles/icon_lol.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':lol:');" alt="Laughing" title="Laughing" /></td>
				</tr>
				<tr align="center" valign="middle">
				  <td><img src="images/smiles/icon_mad.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':x');" alt="Mad" title="Mad" /></td>
				  <td><img src="images/smiles/icon_razz.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':P');" alt="Razz" title="Razz" /></td>
				  <td><img src="images/smiles/icon_redface.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':oops:');" alt="Embarassed" title="Embarassed" /></td>
				  <td><img src="images/smiles/icon_cry.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':cry:');" alt="Crying or Very sad" title="Crying or Very sad" /></td>
				</tr>
				<tr align="center" valign="middle">
				  <td><img src="images/smiles/icon_evil.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':evil:');" alt="Evil or Very Mad" title="Evil or Very Mad" /></td>
				  <td><img src="images/smiles/icon_twisted.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':twisted:');" alt="Twisted Evil" title="Twisted Evil" /></td>
				  <td><img src="images/smiles/icon_rolleyes.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':roll:');" alt="Rolling Eyes" title="Rolling Eyes" /></td>
				  <td><img src="images/smiles/icon_wink.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':wink:');" alt="Wink" title="Wink" /></td>
				</tr>
				<tr align="center" valign="middle">
				  <td><img src="images/smiles/icon_exclaim.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':!:');" alt="Exclamation" title="Exclamation" /></td>
				  <td><img src="images/smiles/icon_question.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':?:');" alt="Question" title="Question" /></td>
				  <td><img src="images/smiles/icon_idea.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':idea:');" alt="Idea" title="Idea" /></td>
				  <td><img src="images/smiles/icon_arrow.gif" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon(':arrow:');" alt="Arrow" title="Arrow" /></td>
				</tr>

			  </table>
</td>
</tr>

</form>
<!-- END quick_reply -->

</table>

<br><p>