채택완료
관리자 페이지 최근게시물 출력시 댓글까지 같이뜨는데..
댓글은 출력을 안하고 싶은데
방법이없나요?ㅠㅠ
댓글달렸을때는 접수중을 다른 처리완료로 바꾸고싶어요

현재이런형태구요
qa 게시판만 사용할예정입니다.
Copy
<?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개 / 댓글 10개
채택된 답변
+20 포인트
댓글은 제외하고싶으시면
아래 부분에서
Copy
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 ";
}
아래와 같이 변경해주세요
Copy
if ($view && $view == 'c')
$sql_common .= " and a.wr_id <> a.wr_parent ";
}else{
$sql_common .= " and a.wr_id = a.wr_parent ";
}
답변에 대한 댓글 6개
Policia
2020-11-25 (수) 17:19:16
jeong1992
2020-11-25 (수) 17:26:39
혹시 정말정말 죄송하지만
만약에 저 게시글에 댓글이 달렸을때는 접수중이라고 되있는 부분을 처리완료 뭐이런식으로 바꿀수있을까요?
만약에 저 게시글에 댓글이 달렸을때는 접수중이라고 되있는 부분을 처리완료 뭐이런식으로 바꿀수있을까요?
Policia
2020-11-25 (수) 17:40:19
출력부분(for문)안에서
출력할부분에 음 예를 들자면 <tr>안에
<td><?php echo ($row['wr_comment']>0)? '처리완료' : '접수중'?></td>
이렇게 추가하면 될것같네요
출력할부분에 음 예를 들자면 <tr>안에
<td><?php echo ($row['wr_comment']>0)? '처리완료' : '접수중'?></td>
이렇게 추가하면 될것같네요
Policia
2020-11-25 (수) 17:41:20
아 $row2입니다 여기선..
<td><?php echo ($row2['wr_comment']>0)? '처리완료' : '접수중'?></td>
<td><?php echo ($row2['wr_comment']>0)? '처리완료' : '접수중'?></td>
병원에서일해요
2020-11-25 (수) 17:31:14
접수중이라고 나오는곳에
if ($list[$i]['comment_cnt']) { echo "처리완료"}
else { echo "접수중"}으로 수정해보세요
답변에 대한 댓글 1개
jeong1992
2020-11-25 (수) 17:37:21
[code]
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);
}
[/code]
이렇게요?
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);
}
[/code]
이렇게요?
내가누구야
2020-11-25 (수) 17:15:12
질문을 정확히 이해 했는지는 모르겠지만 일반적으로 댓글 없이 검색 할 경우
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 ";
붉은 글씨 부분을 추가하여 댓글이 아닌 글만 찾아 보면 되지 않을까요?
답변에 대한 댓글 3개
jeong1992
2020-11-25 (수) 17:20:21
알려주신 소스 적용하니 아예 목록이 안뜹니다ㅠㅠ
참고로 저게시판은 랜딩(db받는 목적)으로 쓰고 있습니다.
관리자가 댓글 입력하면 처리완료? 식으로되고 게시판에는 faq < 스킨 적용해서
그기능이되는데 관리자 메인에서는 안되서요ㅠㅠ
참고로 저게시판은 랜딩(db받는 목적)으로 쓰고 있습니다.
관리자가 댓글 입력하면 처리완료? 식으로되고 게시판에는 faq < 스킨 적용해서
그기능이되는데 관리자 메인에서는 안되서요ㅠㅠ
내가누구야
2020-11-25 (수) 17:24:38
아하하하하.... 제가 테이블을 착각한거였네요. 자세히 안읽어봤나봐요. 죄송하군요
내가누구야
2020-11-25 (수) 17:27:20
select * from $tmp_write_table where wr_id = '{$row['wr_id']}' and wr_is_comment = '0'
$row2 에 추가하시면 댓글 없는 원본글만 보실 수 있을거 같아요
$row2 에 추가하시면 댓글 없는 원본글만 보실 수 있을거 같아요
답변을 작성하려면 로그인이 필요합니다.
어차피 검색이 갖추어지지않았으니
해당 하는 부분 삭제하고
$sql_common .= " and a.wr_id <> a.wr_parent ";
만 넣어도 되겠네요