코멘트 리스트 출력부분 조건출력 정보
코멘트 리스트 출력부분 조건출력본문
<!-- 코멘트 리스트 -->
<div id="commentContents">
<?
for ($i=0; $i<count($list); $i++) {
$comment_id = $list[$i][wr_id];
?>
위 부분이 코멘트 리스트를 출력하는것 같은데요
구현하고자 하는것은 코멘트를 입력한 회원중 남자들이 입력한 코멘트만 출력하고 싶습니다.
이럴때 mb_sex 이걸 활용하면 될듯 싶은데 정확하게 어떻게 코딩해야 하는지요?
아 그리고 코멘트 앞에 숫자 코멘트 번호 1.2.3.... 이렇게 숫자 넣으려면?
<div id="commentContents">
<?
for ($i=0; $i<count($list); $i++) {
$comment_id = $list[$i][wr_id];
?>
위 부분이 코멘트 리스트를 출력하는것 같은데요
구현하고자 하는것은 코멘트를 입력한 회원중 남자들이 입력한 코멘트만 출력하고 싶습니다.
이럴때 mb_sex 이걸 활용하면 될듯 싶은데 정확하게 어떻게 코딩해야 하는지요?
아 그리고 코멘트 앞에 숫자 코멘트 번호 1.2.3.... 이렇게 숫자 넣으려면?
댓글 전체
<?
for ($i=0; $i<count($list); $i++) {
$comment_id = $list[$i][wr_id];
if(!$board['bo_use_signature']&&$list[$i]['mb_id']){//작성자 성별 정보를 가져옵니다.
$mb = @mysql_fetch_array(mysql_query('select mb_sex from '.$g4['member_table'].' where mb_id = \''.$list[$i]['mb_id'].'\''));
}
if($mb['mb_sex']=='M'){//성별이 남자면 출력을 시작합니다.
?>
.
.
<? echo 1+$i;?><!--코멘트 앞에 숫자-->
내용
.
.
</table>
<? } } ?>
</div>
<!-- 코멘트 리스트 -->
.
.
.
for문이 끝나는 부분에서 반드시 <? } } ?> 이렇게 닫아주어야 합니다.
for ($i=0; $i<count($list); $i++) {
$comment_id = $list[$i][wr_id];
if(!$board['bo_use_signature']&&$list[$i]['mb_id']){//작성자 성별 정보를 가져옵니다.
$mb = @mysql_fetch_array(mysql_query('select mb_sex from '.$g4['member_table'].' where mb_id = \''.$list[$i]['mb_id'].'\''));
}
if($mb['mb_sex']=='M'){//성별이 남자면 출력을 시작합니다.
?>
.
.
<? echo 1+$i;?><!--코멘트 앞에 숫자-->
내용
.
.
</table>
<? } } ?>
</div>
<!-- 코멘트 리스트 -->
.
.
.
for문이 끝나는 부분에서 반드시 <? } } ?> 이렇게 닫아주어야 합니다.
고맙습니다. 잘 되네요^^
근데 문제는 리스트가 딱 1개만 올라오고 그 뒤에 올라온 댓글은 안보이네요?
근데 문제는 리스트가 딱 1개만 올라오고 그 뒤에 올라온 댓글은 안보이네요?
basic 스킨으로 테스트를 해보았는데 .. 아주 잘되는데.. 이상하군요.
혹시 회원의 성별 정보가 없는건 아니겠죠?...
혹시 회원의 성별 정보가 없는건 아니겠죠?...
<?
for ($i=0; $i<count($list); $i++) {
$comment_id = $list[$i][wr_id];
if(!$board['bo_use_signature']&&$list[$i]['mb_id']){//작성자 성별 정보를 가져옵니다.
$mb = @mysql_fetch_array(mysql_query('select mb_sex from '.$g4['member_table'].' where mb_id = \''.$list[$i]['mb_id'].'\''));
}
if($mb['mb_sex']=='M'){//성별이 남자면 출력을 시작합니다.
?>
<a name="c_<?=$comment_id?>"></a>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
<td><? for ($k=0; $k<strlen($list[$i][wr_comment_reply]); $k++) echo " "; ?></td>
<td width='100%'>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td height=1 colspan=3 bgcolor="#dddddd"><td>
</tr>
<tr>
<td height=1 colspan=3></td>
</tr>
<tr>
<td valign=top>
<div style="height:28px; background:url(<?=$board_skin_path?>/img/co_title_bg.gif); clear:both; line-height:28px;">
<div style="float:left; margin:2px 0 0 2px;">
<img src='<?=$board_skin_path?>/img/men.gif' border=0 align=absmiddle> <strong><?=$list[$i][name]?></strong>
<span style="color:#888888; font-size:11px;"><?=$list[$i][datetime]?></span>
</div>
<div style="float:right; margin-top:5px;">
<?
if (strstr($list[$i][wr_10], "1")) echo "<span style='color:#red;'><b>신청대기</b></span> ";
if (strstr($list[$i][wr_10], "2")) echo "<span style='color:#ff6600;'><b>승인완료</b></span> ";
?>
<? if ($is_ip_view) { echo " <span style=\"color:#B2B2B2; font-size:11px;\">{$list[$i][ip]}</span>"; } ?>
<? if ($list[$i][is_reply]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'c');\"><img src='$board_skin_path/img/co_btn_reply.gif' border=0 align=absmiddle alt='답변'></a> "; } ?>
<? if ($list[$i][is_edit]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'cu');\"><img src='$board_skin_path/img/co_btn_modify.gif' border=0 align=absmiddle alt='수정'></a> "; } ?>
<? if ($list[$i][is_del]) { echo "<a href=\"javascript:comment_delete('{$list[$i][del_link]}');\"><img src='$board_skin_path/img/co_btn_delete.gif' border=0 align=absmiddle alt='삭제'></a> "; } ?>
</div>
</div>
<!-- 코멘트 출력 -->
<div style='line-height:20px; padding:7px; word-break:break-all; overflow:hidden; clear:both; '>
<?
if (strstr($list[$i][wr_option], "secret")) echo "<span style='color:#ff6600;'>*</span> ";
$str = $list[$i][content];
if (strstr($list[$i][wr_option], "secret"))
$str = "<span class='small' style='color:#ff6600;'>$str</span>";
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);'>", $str);
echo $str;
?>
</div>
<? if ($list[$i][trackback]) { echo "<p>".$list[$i][trackback]."</p>"; } ?>
<span id='edit_<?=$comment_id?>' style='display:none;'></span><!-- 수정 -->
<span id='reply_<?=$comment_id?>' style='display:none;'></span><!-- 답변 -->
</div>
<input type=hidden id='secret_comment_<?=$comment_id?>' value="<?=strstr($list[$i][wr_option],"secret")?>">
<textarea id='save_comment_<?=$comment_id?>' style='display:none;'><?=get_text($list[$i][content1], 0)?></textarea></td>
</td>
</tr>
<tr>
<td height=5 colspan=3></td>
</tr>
</table>
</td>
</tr>
</table>
<? } } ?>
=============== 이렇게 되었는데 안되는데요? 뭐가 잘못된건지 ??? =========================
for ($i=0; $i<count($list); $i++) {
$comment_id = $list[$i][wr_id];
if(!$board['bo_use_signature']&&$list[$i]['mb_id']){//작성자 성별 정보를 가져옵니다.
$mb = @mysql_fetch_array(mysql_query('select mb_sex from '.$g4['member_table'].' where mb_id = \''.$list[$i]['mb_id'].'\''));
}
if($mb['mb_sex']=='M'){//성별이 남자면 출력을 시작합니다.
?>
<a name="c_<?=$comment_id?>"></a>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
<td><? for ($k=0; $k<strlen($list[$i][wr_comment_reply]); $k++) echo " "; ?></td>
<td width='100%'>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td height=1 colspan=3 bgcolor="#dddddd"><td>
</tr>
<tr>
<td height=1 colspan=3></td>
</tr>
<tr>
<td valign=top>
<div style="height:28px; background:url(<?=$board_skin_path?>/img/co_title_bg.gif); clear:both; line-height:28px;">
<div style="float:left; margin:2px 0 0 2px;">
<img src='<?=$board_skin_path?>/img/men.gif' border=0 align=absmiddle> <strong><?=$list[$i][name]?></strong>
<span style="color:#888888; font-size:11px;"><?=$list[$i][datetime]?></span>
</div>
<div style="float:right; margin-top:5px;">
<?
if (strstr($list[$i][wr_10], "1")) echo "<span style='color:#red;'><b>신청대기</b></span> ";
if (strstr($list[$i][wr_10], "2")) echo "<span style='color:#ff6600;'><b>승인완료</b></span> ";
?>
<? if ($is_ip_view) { echo " <span style=\"color:#B2B2B2; font-size:11px;\">{$list[$i][ip]}</span>"; } ?>
<? if ($list[$i][is_reply]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'c');\"><img src='$board_skin_path/img/co_btn_reply.gif' border=0 align=absmiddle alt='답변'></a> "; } ?>
<? if ($list[$i][is_edit]) { echo "<a href=\"javascript:comment_box('{$comment_id}', 'cu');\"><img src='$board_skin_path/img/co_btn_modify.gif' border=0 align=absmiddle alt='수정'></a> "; } ?>
<? if ($list[$i][is_del]) { echo "<a href=\"javascript:comment_delete('{$list[$i][del_link]}');\"><img src='$board_skin_path/img/co_btn_delete.gif' border=0 align=absmiddle alt='삭제'></a> "; } ?>
</div>
</div>
<!-- 코멘트 출력 -->
<div style='line-height:20px; padding:7px; word-break:break-all; overflow:hidden; clear:both; '>
<?
if (strstr($list[$i][wr_option], "secret")) echo "<span style='color:#ff6600;'>*</span> ";
$str = $list[$i][content];
if (strstr($list[$i][wr_option], "secret"))
$str = "<span class='small' style='color:#ff6600;'>$str</span>";
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);'>", $str);
echo $str;
?>
</div>
<? if ($list[$i][trackback]) { echo "<p>".$list[$i][trackback]."</p>"; } ?>
<span id='edit_<?=$comment_id?>' style='display:none;'></span><!-- 수정 -->
<span id='reply_<?=$comment_id?>' style='display:none;'></span><!-- 답변 -->
</div>
<input type=hidden id='secret_comment_<?=$comment_id?>' value="<?=strstr($list[$i][wr_option],"secret")?>">
<textarea id='save_comment_<?=$comment_id?>' style='display:none;'><?=get_text($list[$i][content1], 0)?></textarea></td>
</td>
</tr>
<tr>
<td height=5 colspan=3></td>
</tr>
</table>
</td>
</tr>
</table>
<? } } ?>
=============== 이렇게 되었는데 안되는데요? 뭐가 잘못된건지 ??? =========================
원인을 찾았습니다....
</table>
<? } } ?>
</div>
<!-- 코멘트 리스트 -->
위에걸
</table>
<? unset($mb['mb_sex']);} } ?>
</div>
<!-- 코멘트 리스트 -->
이렇게 unset으로 $mb['mb_sex']변수를 삭제 해주어야 합니다...
</table>
<? } } ?>
</div>
<!-- 코멘트 리스트 -->
위에걸
</table>
<? unset($mb['mb_sex']);} } ?>
</div>
<!-- 코멘트 리스트 -->
이렇게 unset으로 $mb['mb_sex']변수를 삭제 해주어야 합니다...