테스트 사이트 - 개발 중인 베타 버전입니다

목록에서 댓글 출력 관련 채택완료

웹프리존 11년 전 조회 7,534

댓글을 뷰페이지에서가 아닌 리스트에서 보여주고 작성하고 하는데요

다른 문제는 수정해서 해결이 되었는데

http://ymik.cafe24.com/bbs/board.php?bo_table=best_vote">http://ymik.cafe24.com/bbs/board.php?bo_table=best_vote

댓글보기 클릭하면 각 게시글별로 똑같이 출력이 되는데

 머가 잘못된걸까요.

 

<?php

$list3 = 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 ";

$sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";

$result5 = sql_query($sql);

for ($q=0; $row=sql_fetch_array($result5); $q++)

{

    $list3[$q] = $row;

 

    //$list3[$q]['name'] = get_sideview($row['mb_id'], cut_str($row['wr_name'], 20, ''), $row['wr_email'], $row['wr_homepage']);

 

    $tmp_name = get_text(cut_str($row['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력

    if ($board['bo_use_sideview'])

        $list3[$q]['name'] = get_sideview($row['mb_id'], $tmp_name, $row['wr_email'], $row['wr_homepage']);

    else

        $list3[$q]['name'] = '<span class="'.($row['mb_id']?'member':'guest').'">'.$tmp_name.'</span>';

 

 

 

    // 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)

    //$list3[$q]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $row['wr_content']);

 

    $list3[$q]['content'] = $list3[$q]['content1']= '비밀글 입니다.';

    if (!strstr($row['wr_option'], 'secret') ||

        $is_admin ||

        ($write['mb_id']==$member['mb_id'] && $member['mb_id']) ||

        ($row['mb_id']==$member['mb_id'] && $member['mb_id'])) {

        $list3[$q]['content1'] = $row['wr_content'];

        $list3[$q]['content'] = conv_content($row['wr_content'], 0, 'wr_content');

        $list3[$q]['content'] = search_font($stx, $list3[$q]['content']);

    }

 

    $list3[$q]['datetime'] = substr($row['wr_datetime'],2,14);

 

    // 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.

    $list3[$q]['ip'] = $row['wr_ip'];

    if (!$is_admin)

        $list3[$q]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['wr_ip']);

 

    $list3[$q]['is_reply'] = false;

    $list3[$q]['is_edit'] = false;

    $list3[$q]['is_del']  = false;

    if ($is_comment_write || $is_admin)

    {

        if ($member['mb_id'])

        {

            if ($row['mb_id'] == $member['mb_id'] || $is_admin)

            {

                $list3[$q]['del_link']  = './delete_comment.php?bo_table='.$bo_table.'&amp;comment_id='.$row['wr_id'].'&amp;token='.$token.'&amp;page='.$page.$qstr;

                $list3[$q]['is_edit']   = true;

                $list3[$q]['is_del']    = true;

            }

        }

        else

        {

            if (!$row['mb_id']) {

                $list3[$q]['del_link'] = './password.php?w=x&amp;bo_table='.$bo_table.'&amp;comment_id='.$row['wr_id'].'&amp;page='.$page.$qstr;

                $list3[$q]['is_del']   = true;

            }

        }

 

        if (strlen($row['wr_comment_reply']) < 5)

            $list3[$q]['is_reply'] = true;

    }

 

    // 05.05.22

    // 답변있는 코멘트는 수정, 삭제 불가

    if ($i > 0 && !$is_admin)

    {

        if ($row['wr_comment_reply'])

        {

            $tmp_comment_reply = substr($row['wr_comment_reply'], 0, strlen($row['wr_comment_reply']) - 1);

            if ($tmp_comment_reply == $list3[$i-1]['wr_comment_reply'])

            {

                $list3[$i-1]['is_edit'] = false;

                $list3[$i-1]['is_del'] = false;

            }

        }

    }

}

 

//  코멘트수 제한 설정값

if ($is_admin)

{

    $comment_min = $comment_max = 0;

}

else

{

    $comment_min = (int)$board['bo_comment_min'];

    $comment_max = (int)$board['bo_comment_max'];

}

<?php } ?> 

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
11년 전

코멘트 출력에서. 

$sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";

 

$wr_id는 고정된 값아닌가요?

 

$list[$i][wr_id] 라든지,  그 고유값을 적용시켜주면,  그에 맞는 댓글도 추출되지 않을까 싶습니다.​

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인