관리자 페이지 최근게시물 출력시 댓글까지 같이뜨는데..

관리자 페이지 최근게시물 출력시 댓글까지 같이뜨는데..

QA

관리자 페이지 최근게시물 출력시 댓글까지 같이뜨는데..

답변 3

본문

댓글은 출력을 안하고 싶은데

방법이없나요?ㅠㅠ

 

댓글달렸을때는 접수중을 다른 처리완료로 바꾸고싶어요

 2949855436_1606291225.4767.png

현재이런형태구요

qa 게시판만 사용할예정입니다.

 

 


<?php
$sub_menu = '100000';
include_once('./_common.php');
@include_once('./safe_check.php');
if(function_exists('social_log_file_delete')){
    social_log_file_delete(86400);      //소셜로그인 디버그 파일 24시간 지난것은 삭제
}
$g5['title'] = '관리자메인';
include_once ('./admin.head.php');
$new_member_rows = 5;
$new_point_rows = 5;
$new_write_rows = 30;
$sql_common = " from {$g5['member_table']} ";
$sql_search = " where (1) ";
if ($is_admin != 'super')
    $sql_search .= " and mb_level <= '{$member['mb_level']}' ";
if (!$sst) {
    $sst = "mb_datetime";
    $sod = "desc";
}
$sql_order = " order by {$sst} {$sod} ";
$sql = " select count(*) as cnt {$sql_common} {$sql_search} {$sql_order} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
// 탈퇴회원수
$sql = " select count(*) as cnt {$sql_common} {$sql_search} and mb_leave_date <> '' {$sql_order} ";
$row = sql_fetch($sql);
$leave_count = $row['cnt'];
// 차단회원수
$sql = " select count(*) as cnt {$sql_common} {$sql_search} and mb_intercept_date <> '' {$sql_order} ";
$row = sql_fetch($sql);
$intercept_count = $row['cnt'];
$sql = " select * {$sql_common} {$sql_search} {$sql_order} limit {$new_member_rows} ";
$result = sql_query($sql);
$colspan = 12;
?>
<?php
$sql_common = " from {$g5['board_new_table']} a, {$g5['board_table']} b, {$g5['group_table']} c where a.bo_table = b.bo_table and b.gr_id = c.gr_id ";
if ($gr_id)
    $sql_common .= " and b.gr_id = '$gr_id' ";
if ($view) {
    if ($view == 'w')
        $sql_common .= " and a.wr_id = a.wr_parent ";
    else if ($view == 'c')
        $sql_common .= " and a.wr_id <> a.wr_parent ";
}
$sql_order = " order by a.bn_id desc ";
$sql = " select count(*) as cnt {$sql_common} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$colspan = 5;
?>
<style>
.qnaIco{display:inline-block;margin-right:5px; border-radius:3px; background:#999; width:80px; height:24px; line-height:24px; color:#fff; text-align:center;}
.qnaIco1{background:#4158d1}
.qnaIco2{background:#993399}
.qnaIco3{background:#cccccc}
</style>

<section>
    <h2>최근게시물</h2>
    <div class="tbl_head01 tbl_wrap">
        <div class="btn_list03 btn_list">
            <a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=qa">상담게시판 바로가기</a>
        </div>
        <table>
        <caption>최근게시물</caption>
        <thead>
        <tr>
            <th scope="col">진행상황</th>
            <th scope="col">이름</th>
            <th scope="col">연락처</th>
            <th scope="col">일시</th>
        </tr>
        </thead>
        <tbody>
        <?php
        $sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id {$sql_common} {$sql_order} limit {$new_write_rows} ";
        $result = sql_query($sql);
        for ($i=0; $row=sql_fetch_array($result); $i++)
        {
            $tmp_write_table = $g5['write_prefix'] . $row['bo_table'];
            if ($row['wr_id'] == $row['wr_parent']) // 원글
            {
                $comment = '<span class="qnaIco qnaIco3"><i class="fa fa-spinner"></i> 접수중</span> ';
                $comment_link = "";
                $row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '{$row['wr_id']}' ");
                $name = get_sideview($row2['mb_id'], get_text(cut_str($row2['wr_name'], $config['cf_cut_name'])), $row2['wr_email'], $row2['wr_homepage']);
                // 당일인 경우 시간으로 표시함
                $datetime = $row2['wr_datetime'];
                $datetime2 = $row2['wr_datetime'];
                if ($datetime == G5_TIME_YMD)
                    $datetime2 = substr($datetime2,11,5);
                else
                    $datetime2 = substr($datetime2,5,5);
            }
        ?>
        <tr>
            <td class="td_num2">
                <a href="<?php echo get_pretty_url($row['bo_table'], $row2['wr_id']); ?>"><?php echo $comment ?></a>
            </td>
            <td class="td_mbname"><div><?php echo $name ?></div></td>
            <td><?php echo $row2['wr_7'] ?>-<?php echo $row2['wr_8'] ?>-<?php echo $row2['wr_9'] ?></td>
            <td class="td_datetime"><?php echo $datetime ?></td>
        </tr>
        <?php
        }
        if ($i == 0)
            echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
        ?>
        </tbody>
        </table>
    </div>
</section>

<?php
include_once ('./admin.tail.php');
?>
 

이 질문에 댓글 쓰기 :

답변 3

댓글은 제외하고싶으시면 

 

아래 부분에서



if ($view) {
    if ($view == 'w')
        $sql_common .= " and a.wr_id = a.wr_parent ";
    else if ($view == 'c')
        $sql_common .= " and a.wr_id <> a.wr_parent ";
}

 

아래와 같이 변경해주세요



if ($view && $view == 'c')
        $sql_common .= " and a.wr_id <> a.wr_parent ";
}else{

        $sql_common .= " and a.wr_id = a.wr_parent ";
}

디폴트를 게시글만으로 잡은 상태고 검색값($view)가 있을경우 댓글이면 댓글만 보여줄수있도록하였습니다 근데 생각해보니 관리자페이지의 최신게시물이네요
어차피 검색이 갖추어지지않았으니
해당 하는 부분 삭제하고
$sql_common .= " and a.wr_id <> a.wr_parent ";
만 넣어도 되겠네요

질문을 정확히 이해 했는지는 모르겠지만 일반적으로 댓글 없이 검색 할 경우

if ($view) {
    if ($view == 'w')
        $sql_common .= " and a.wr_id = a.wr_parent ";
    else if ($view == 'c')
        $sql_common .= " and a.wr_id <> a.wr_parent ";
}
$sql_common .= " and b.wr_is_comment = '0' ";
$sql_order = " order by a.bn_id desc ";

 

붉은 글씨 부분을 추가하여 댓글이 아닌 글만 찾아 보면 되지 않을까요?

알려주신 소스 적용하니 아예 목록이 안뜹니다ㅠㅠ

참고로 저게시판은 랜딩(db받는 목적)으로 쓰고 있습니다.
관리자가 댓글 입력하면 처리완료? 식으로되고 게시판에는 faq < 스킨 적용해서
그기능이되는데 관리자 메인에서는 안되서요ㅠㅠ

접수중이라고 나오는곳에

if ($list[$i]['comment_cnt']) { echo "처리완료"}

else { echo "접수중"}으로 수정해보세요


  if ($row['wr_id'] == $row['wr_parent']) // 원글
            {
                $comment = '<span class="qnaIco qnaIco3"><i class="fa fa-spinner"></i> 접수중</span> ';
				if ($list[$i]['comment_cnt']) { echo "처리완료"} else{ echo "접수중"};
                $comment_link = "";
                $row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '{$row['wr_id']}' ");

                $name = get_sideview($row2['mb_id'], get_text(cut_str($row2['wr_name'], $config['cf_cut_name'])), $row2['wr_email'], $row2['wr_homepage']);
                // 당일인 경우 시간으로 표시함
                $datetime = $row2['wr_datetime'];
                $datetime2 = $row2['wr_datetime'];
                if ($datetime == G5_TIME_YMD)
                    $datetime2 = substr($datetime2,11,5);
                else
                    $datetime2 = substr($datetime2,5,5);

            }


이렇게요?

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 31
© SIRSOFT
현재 페이지 제일 처음으로