latest_popular_up 전체 일간 주간 조회수 추천수 각 게시판 인기글 적용 시 댓글이 노출되는 문제 채택완료
굼떠
9개월 전
조회 2,309
아침안개님이 올려주신 게시글 추출소스를 적용해보고 있는데
board_new 테이블에 들어가있는 댓글까지 순위로 노출시키는 것 같습니다.(코멘트의 경우 글 제목이 없어 공란으로 노출되나 링크는 코멘트가 달려있는 원글로 이동)
어떤 부분을 수정해야 코멘트는 제외하고 노출시킬 수 있을까요?
</p>
<p>$sql_between = " a.bn_datetime between '$term_time' and '".G5_TIME_YMDHIS."' ";</p>
<p> $sql_common = " from {$g5['board_new_table']} a, {$g5['board_table']} b where a.bo_table = b.bo_table and b.bo_use_search = 1 and a.wr_id = a.wr_parent and {$sql_between} ";</p>
<p> $sql_order = " order by a.bn_datetime desc ";</p>
<p> </p>
<p> $sql = " select a.*, count(b.bo_subject) as cnt {$sql_common} {$sql_order} limit 0, {$rows} ";</p>
<p> $row = sql_fetch($sql);</p>
<p> </p>
<p> </p>
<p> if($row['cnt'] > 0){</p>
<p> $sql = " select a.*, b.bo_subject {$sql_common} {$sql_order} limit 0, {$rows} ";</p>
<p> $result = sql_query($sql);</p>
<p> </p>
<p> for ($i=0; $row = sql_fetch_array($result); $i++){</p>
<p> $tmp_write_table = $g5['write_prefix'].$row['bo_table'];</p>
<p> $bo_table = $row['bo_table'];</p>
<p> </p>
<p> if($i > 0)</p>
<p> $sql2 .= " union ";</p>
<p> $sql2 .= "(select '{$bo_table}' as bo_table, wr_id, wr_subject, wr_hit, wr_good from {$tmp_write_table} where wr_datetime between '{$term_time}' and '".G5_TIME_YMDHIS."') ";</p>
<p> }</p>
<p> $sql2 .= " order by ".$options." limit 0, 10";</p>
<p> $result2 = sql_query($sql2);</p>
<p> </p>
<p> for ($i=0; $row2 = sql_fetch_array($result2); $i++){</p>
<p> $list[$i]['href'] = G5_BBS_URL.'/board.php?bo_table='.$row2['bo_table'].'&wr_id='.$row2['wr_id'];</p>
<p> $list[$i]['subject'] = $row2['wr_subject'];</p>
<p> }</p>
<p> }</p>
<p> </p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
9개월 전
</p>
<p>$sql_between = " a.bn_datetime between '$term_time' and '".G5_TIME_YMDHIS."' ";
$sql_common = " from {$g5['board_new_table']} a, {$g5['board_table']} b where a.bo_table = b.bo_table and b.bo_use_search = 1 and a.wr_id = a.wr_parent and a.wr_comment = 0 and {$sql_between} "; // wr_comment = 0 조건 추가
$sql_order = " order by a.bn_datetime desc ";</p>
<p>$sql = " select a.*, count(b.bo_subject) as cnt {$sql_common} {$sql_order} limit 0, {$rows} ";
$row = sql_fetch($sql);</p>
<p>if($row['cnt'] > 0){
$sql = " select a.*, b.bo_subject {$sql_common} {$sql_order} limit 0, {$rows} ";
$result = sql_query($sql);</p>
<p> for ($i=0; $row = sql_fetch_array($result); $i++){
$tmp_write_table = $g5['write_prefix'].$row['bo_table'];
$bo_table = $row['bo_table'];</p>
<p> if($i > 0)
$sql2 .= " union ";
$sql2 .= "(select '{$bo_table}' as bo_table, wr_id, wr_subject, wr_hit, wr_good from {$tmp_write_table} where wr_datetime between '{$term_time}' and '".G5_TIME_YMDHIS."' and wr_comment = 0) "; // wr_comment = 0 조건 추가
}
$sql2 .= " order by ".$options." limit 0, 10";
$result2 = sql_query($sql2);</p>
<p> for ($i=0; $row2 = sql_fetch_array($result2); $i++){
$list[$i]['href'] = G5_BBS_URL.'/board.php?bo_table='.$row2['bo_table'].'&wr_id='.$row2['wr_id'];
$list[$i]['subject'] = $row2['wr_subject'];
}
}</p>
<p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
�
들레아빠
9개월 전
채택 감사 합니다.
�
굼떠
9개월 전
늘 감사합니다 :)
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인