답변 3개
채택된 답변
+20 포인트
eyekiss
4년 전
bbs\list.php 파일을 아래와 같이 수정해보세요
Copy
// 분류 사용 여부
$is_category = false;
$category_option = '';
if ($board['bo_use_category']) {
$is_category = true;
$category_href = G5_BBS_URL.'/board.php?bo_table='.$bo_table;
$category_option .= '<li><a href="'.$category_href.'"';
if ($sca=='')
$category_option .= ' id="bo_cate_on"';
$category_option .= '>전체</a></li>';
$categories = explode('|', $board['bo_category_list']); // 구분자가 , 로 되어 있음
if($member['mb_level']<5) {
$key = array_search('다', $categories);
array_splice( $categories, $key, 1 );
}
for ($i=0; $i<count($categories); $i++) {
$category = trim($categories[$i]);
if ($category=='') continue;
$category_option .= '<li><a href="'.($category_href."&sca=".urlencode($category)).'"';
$category_msg = '';
if ($category==$sca) { // 현재 선택된 카테고리라면
$category_option .= ' id="bo_cate_on"';
$category_msg = '<span class="sound_only">열린 분류 </span>';
}
$category_option .= '>'.$category_msg.$category.'</a></li>';
}
}
$incate = "'".implode("','",$categories)."'";
$sop = strtolower($sop);
if ($sop != 'and' && $sop != 'or')
$sop = 'and';
// 분류 선택 또는 검색어가 있다면
$stx = trim($stx);
//검색인지 아닌지 구분하는 변수 초기화
$is_search_bbs = false;
if ($sca || $stx || $stx === '0') { //검색이면
$is_search_bbs = true; //검색구분변수 true 지정
$sql_search = get_sql_search($sca, $sfl, $stx, $sop);
// 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)
$sql = " select MIN(wr_num) as min_wr_num from {$write_table} ";
$row = sql_fetch($sql);
$min_spt = (int)$row['min_wr_num'];
if (!$spt) $spt = $min_spt;
$sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) ";
// 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
// 라엘님 제안 코드로 대체 http://sir.kr/g5_bug/2922
$sql = " SELECT COUNT(DISTINCT `wr_parent`) AS `cnt` FROM {$write_table} WHERE {$sql_search} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
/*
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
$result = sql_query($sql);
$total_count = sql_num_rows($result);
*/
$sql_search .= " and ca_name in ($incate) ";
} else {
$is_search_bbs = true;
$sql_search = " ca_name in ($incate) ";
$total_count = $board['bo_count_write'];
}
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
sozet
4년 전
eyekiss
4년 전
https://www.delftstack.com/ko/howto/php/how-to-delete-an-element-from-an-array-in-php/
이 내용 참조하시고.. 아래 부분을 반복해서 추가해주면 됩니다.
$key = array_search('다', $categories);
array_splice( $categories, $key, 1 );
이 내용 참조하시고.. 아래 부분을 반복해서 추가해주면 됩니다.
$key = array_search('다', $categories);
array_splice( $categories, $key, 1 );
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
회원등긍 5이상이면 "다" 카테고리외에 더 추가하려면 어떻게 해야 되나요??
그리고 skin.list.php만 손대서는 안되나요??
감사합니다~