여분필드 값으로 url접속 하는 방법이 궁금합니다. 채택완료
아래와 같이 주소줄에 입력하면
여분필드 wr_10이 국산차인 게시물만 보이게 하고 싶어요
http://car.bye.kr/bbs/board.php?bo_table=carSell&wr_10=국산차
멀티 카테고리의 경우
아래와 같이 주소줄에 입력하면 제대로 노출이 되거든요 ㅠㅠ
왜 여분필드 wr_10은 되지 않을까요 ?
답변 4개
/.htaccess 파일에 삽입
RewriteEngine on
RewriteCond %{QUERY_STRING} ^bo_table=([^&]+)&wr_10=([^&]+)$
RewriteRule ^ bbs/board.php?bo_table=%1&sfl=wr_10&stx=%2 [L]
댓글을 작성하려면 로그인이 필요합니다.
if($_GET['wr_10']) {
$sql_search .= " and wr_10='{$_GET['wr_10']}' ";
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
$result = sql_query($sql);
} else {
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
}
$result = sql_query($sql);
$total_count = sql_num_rows($result);
*/
} else {
$sql_search = "";
$total_count = $board['bo_count_write'];
}
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
sfl 과 stx 는 이미 list.php 에서 쿼리문을 만들때 값을 넘겨주도록 되어 있습니다.
그러나 wr_1~wr_10 은 아무리 값을 넘겨도 쿼리문에 그 조건이 추가가 안되는 것입니다.
이것은 쿼리문을 수정하여 해결을 할 수 있는데,
list.php 67줄에 아래 소스를 넣어 해결할 수 있습니다.
if($wr_10) $sql_search .= " and wr_10='$wr_10' ";
답변에 대한 댓글 3개
$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);
*/
} else {
$sql_search = "";
$total_count = $board['bo_count_write'];
}
$sql_search = "";
$total_count = $board['bo_count_write'];
}
아랫줄에 다음과 같이 넣어보세요.
if($_GET['wr_10']) $sql_search .= " and wr_10='{$_GET['wr_10']}' ";
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
$result = sql_query($sql);
$total_count = sql_num_rows($result);
*/
} else {
$sql_search = "";
$total_count = $board['bo_count_write'];
}
if($_GET['wr_10']) $sql_search .= " and wr_10='{$_GET['wr_10']}' ";
if(G5_IS_MOBILE) {
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인