예비필드의 특정값을 가지고있는 게시물만 리스트에 노출하기
이 소스는 등록된 게시물중 예비필드에 특정값이 들어있는 것만 리스팅하고 싶을때 사용합니다
ex) 게시판아이디가 free 이고 게시물중에 wr_1 wr_2 에 각각 이벤트상품 10월 이라는 값이 들어가 있는것만 출력하고 싶을때~
/bbs/list.php 를 열고
1. 맨처음 소스인 if (!defined('_GNUBOARD_')) exit; 다음에
아래의 소스를 넣으세요
if( $bo_table == 'free' ){
$fldName[] = "wr_1";
$fldName[] = "wr_2";
$fldValue[] = "이벤트상품";
$fldValue[] = "10월";
for($f = 0; $f < count($fldName); $f++){
$sql_search_fld .= " AND {$fldName[$f]} = '{$fldValue[$f]}' ";
}
}
2. 쿼리 편집하기 ( 각 쿼리에 {$sql_search_fld} 를 추가하는것입니다 )
$sql = " select distinct wr_parent from {$write_table} where {$sql_search}";
를
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_search_fld}";
로 변경
$total_count = $board['bo_count_write'];
를
if($bo_table == "free"){
$sql = " select distinct wr_parent from {$write_table} where 1 {$sql_search} {$sql_search_fld}";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
}else{
$total_count = $board['bo_count_write'];
}
로 변경
if ($sca || $stx) {
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";
} else {
$sql = " select * from {$write_table} where wr_is_comment = 0 ";
if(!empty($notice_array))
$sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
$sql .= " {$sql_order} limit {$from_record}, $page_rows ";
}
를
if ($sca || $stx) {
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_search_fld} {$sql_order} limit {$from_record}, $page_rows ";
} else {
$sql = " select * from {$write_table} where wr_is_comment = 0 {$sql_search_fld} ";
if(!empty($notice_array))
$sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
$sql .= " {$sql_order} limit {$from_record}, $page_rows ";
}
로 변경
이렇게 하면 게시판아이디 free의 리스트에는 이벤트상품 10월 의 값이 들어있는 게시물만 리스팅됩니다
댓글 2개
10년 전
그렇지않아도 찾고 있던 참 인데 좋은정보 감사합니다.
1. 그런데 혹시 다음과 같이 하면 안될 까요 ??
$sql = " select distinct wr_parent from {$write_table} where {$sql_search}"; 앞에
$sql_search .= {$sql_search_fld}; 추가
그러면 좀더 간단히 될 것 같기도 한데 ...
2. /bbs/list.php 를 손대지 않고 list.skin.php 으로 처리할 방법은 없는 지요 ??
1. 그런데 혹시 다음과 같이 하면 안될 까요 ??
$sql = " select distinct wr_parent from {$write_table} where {$sql_search}"; 앞에
$sql_search .= {$sql_search_fld}; 추가
그러면 좀더 간단히 될 것 같기도 한데 ...
2. /bbs/list.php 를 손대지 않고 list.skin.php 으로 처리할 방법은 없는 지요 ??
10년 전
감사
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4402 | ||
| 2394 | 1년 전 | 5049 | ||
| 2393 |
|
1년 전 | 1699 | |
| 2392 |
|
1년 전 | 1358 | |
| 2391 |
|
1년 전 | 1140 | |
| 2390 |
|
1년 전 | 1192 | |
| 2389 | 1년 전 | 1780 | ||
| 2388 | 1년 전 | 1325 | ||
| 2387 | 1년 전 | 1309 | ||
| 2386 |
투명한열정
|
1년 전 | 3073 | |
| 2385 |
|
1년 전 | 2341 | |
| 2384 | 1년 전 | 1668 | ||
| 2383 | 1년 전 | 1803 | ||
| 2382 | 1년 전 | 1455 | ||
| 2381 |
|
1년 전 | 1872 | |
| 2380 | 1년 전 | 1042 | ||
| 2379 | 1년 전 | 1385 | ||
| 2378 | 1년 전 | 919 | ||
| 2377 | 1년 전 | 2997 | ||
| 2376 | 1년 전 | 1562 | ||
| 2375 | 1년 전 | 1735 | ||
| 2374 |
네이비스택
|
1년 전 | 1115 | |
| 2373 | 1년 전 | 1547 | ||
| 2372 | 1년 전 | 1468 | ||
| 2371 |
goodman148
|
1년 전 | 2111 | |
| 2370 | 1년 전 | 1519 | ||
| 2369 |
|
1년 전 | 1032 | |
| 2368 | 1년 전 | 1836 | ||
| 2367 | 1년 전 | 1356 | ||
| 2366 |
|
1년 전 | 1213 | |
| 2365 | 1년 전 | 2142 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기