[그누•영카트] 인기검색어 등록 특정 단어 제외시키기
페이지 정보
shadow2fox
2,482
2019.12.17 23:04:00
짧은주소
-
https://yadolee.com/tip/706 주소복사
본문
인기검색어 등록 특정 단어 제외시키기
검색은 허용하되 인기검색어에 등록되지 않았으면 하는 경우 아래처럼 수정해 보자.
그누보드5/lib/common.lib.php를 열어 // 인기검색어 입력을 검색한다.
수정 전
대소문자를 구별해 제외하고 싶다면 !in_array(strtolower($str), $str_filter)를 !in_array($str, $str_filter)로 변경한다.
그누보드5/lib/common.lib.php를 열어 // 인기검색어 입력을 검색한다.
수정 전
// 인기검색어 입력
function insert_popular($field, $str)
{
global $g5
if(!in_array('mb_id', $field)) {
$sql = " insert into {$g5['popular_table']} set pp_word = '{$str}', pp_date = '".G5_TIME_YMD."', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql, FALSE);
}
}
수정 후
// 인기검색어 입력
function insert_popular($field, $str)
{
global $g5
// 특정 검색어 제외
$str_filter = array('단어1','단어2','단어3','단어4','단어5');
if(!in_array('mb_id', $field) && !in_array(strtolower($str), $str_filter)) {
$sql = " insert into {$g5['popular_table']} set pp_word = '{$str}', pp_date = '".G5_TIME_YMD."', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql, FALSE);
}
}
대소문자를 구별해 제외하고 싶다면 !in_array(strtolower($str), $str_filter)를 !in_array($str, $str_filter)로 변경한다.
추천인
레벨 149
경험치 3,343,659
Progress Bar 80.23%
- 가입일 : 2015-03-10 12:21:44
- 서명 : 인간에게 가장 큰 선물은
자기 자신에게 기회를 주는 것이다.
- 크리스 가드너, Chris Gardner -
- 자기소개 : There's never a shortcut to happiness.



댓글
첫 번째 댓글을 남겨 주세요