Copy
<!-- 코멘트 리스트 --> <?php $wr_id= $list[$i][wr_id]; $colist = array(); $is_comment_write = false; if ($member['mb_level'] >= $board['bo_comment_level']) $is_comment_write = true; // 코멘트 출력 //$sql = " select * from {$write_table} where wr_parent = '{$wr_id}' and wr_is_comment = 1 order by wr_comment desc, wr_comment_reply "; $cosql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply "; $coresult = sql_query($cosql); for ($ii=0; $corow=sql_fetch_array($coresult); $ii++) { $colist[$ii] = $corow; //$list[$i]['name'] = get_sideview($row['mb_id'], cut_str($row['wr_name'], 20, ''), $row['wr_email'], $row['wr_homepage']); $cotmp_name = get_text(cut_str($corow['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력 if ($board['bo_use_sideview']) $colist[$ii]['name'] = get_sideview($corow['mb_id'], $cotmp_name, $corow['wr_email'], $corow['wr_homepage']); else $colist[$ii]['name'] = '<span class="'.($corow['mb_id']?'member':'guest').'">'.$cotmp_name.'</span>'; // 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr) //$list[$i]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $row['wr_content']); $colist[$ii]['content'] = $colist[$ii]['content1']= '비밀글 입니다.'; if (!strstr($corow['wr_option'], 'secret') || $is_admin || ($write['mb_id']==$member['mb_id'] && $member['mb_id']) || ($corow['mb_id']==$member['mb_id'] && $member['mb_id'])) { $colist[$ii]['content1'] = $corow['wr_content']; $colist[$ii]['content'] = conv_content($corow['wr_content'], 0, 'wr_content'); $colist[$ii]['content'] = search_font($stx, $colist[$ii]['content']); } else { $ss_name = 'ss_secret_comment_'.$bo_table.'_'.$colist[$ii]['wr_id']; if(!get_session($ss_name)) $colist[$ii]['content'] = '<a href="./password.php?w=sc&bo_table='.$bo_table.'&wr_id='.$colist[$ii]['wr_id'].$qstr.'" class="s_cmt">댓글내용 확인</a>'; else { $colist[$ii]['content'] = conv_content($corow['wr_content'], 0, 'wr_content'); $colist[$ii]['content'] = search_font($stx, $colist[$ii]['content']); } } $colist[$ii]['datetime'] = substr($corow['wr_datetime'],2,14); // 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다. $colist[$ii]['ip'] = $corow['wr_ip']; if (!$is_admin) $colist[$ii]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $corow['wr_ip']); $colist[$ii]['is_reply'] = false; $colist[$ii]['is_edit'] = false; $colist[$ii]['is_del'] = false; if ($is_comment_write || $is_admin) { if ($member['mb_id']) { if ($corow['mb_id'] == $member['mb_id'] || $is_admin) { $colist[$ii]['del_link'] = './delete_comment.php?bo_table='.$bo_table.'&comment_id='.$corow['wr_id'].'&token='.$token.'&page='.$page.$qstr; $colist[$ii]['is_edit'] = true; $colist[$ii]['is_del'] = true; } } else { if (!$corow['mb_id']) { $colist[$ii]['del_link'] = './password.php?w=x&bo_table='.$bo_table.'&comment_id='.$corow['wr_id'].'&page='.$page.$qstr; $colist[$ii]['is_del'] = true; } } if (strlen($corow['wr_comment_reply']) < 5) $colist[$ii]['is_reply'] = true; } // 05.05.22 // 답변있는 코멘트는 수정, 삭제 불가 if ($ii > 0 && !$is_admin) { if ($corow['wr_comment_reply']) { $cotmp_comment_reply = substr($corow['wr_comment_reply'], 0, strlen($corow['wr_comment_reply']) - 1); if ($cotmp_comment_reply == $colist[$ii-1]['wr_comment_reply']) { $colist[$ii-1]['is_edit'] = false; $colist[$ii-1]['is_del'] = false; } } } } ?> <!-- 댓글 시작 { --> <section id="bo_vc"> <h2>댓글목록</h2> <?php $viewContent = array(); for ($ii=0; $ii<count($colist); $ii++) { $viewComment[] = new Comment($colist[$ii]); } /*foreach($viewComment as $c){ echo $c->markup(); }*/ if (is_array($viewComment)) { foreach ($viewComment as $c) { echo $c->markup(); } } ?> <?php if (count($colist) == 0) { //댓글이 없다면 ?><p id="bo_vc_empty">등록된 댓글이 없습니다.</p><?php } ?> </section> <!-- } 댓글 끝 --> <!-- 코멘트 리스트 끝 -->
view_comment와 view_comment_skin을 참고해서 위와같이 작성했는데요
--------------
A글
A글의 코멘트
B글
B글의 코멘트
C글
C글의 코멘트
--------------
이렇게 떠야하는데
--------------
A글
A글의 코멘트
B글
A글의 코멘트
B글의 코멘트
C글
A글의 코멘트
B글의 코멘트
C글의 코멘트
--------------
이렇게 뜹니다..ㅠㅠ
무엇이 문제일까요ㅠㅠ
|
답변 1개 / 댓글 1개
채택된 답변
+20 포인트
9년 전
$viewContent = array();
이걸
$viewContent = $viewComment = array();
이렇게 바꿔 보세요.
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.