여분필드 값으로 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]
sfl 과 stx 는 이미 list.php 에서 쿼리문을 만들때 값을 넘겨주도록 되어 있습니다.
그러나 wr_1~wr_10 은 아무리 값을 넘겨도 쿼리문에 그 조건이 추가가 안되는 것입니다.
이것은 쿼리문을 수정하여 해결을 할 수 있는데,
list.php 67줄에 아래 소스를 넣어 해결할 수 있습니다.
if($wr_10) $sql_search .= " and wr_10='$wr_10' ";
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'];
}