반응형테마는 배너설정에서 모바일로 선택해야 PC에서도 배너가 표시되죠.
반응형을 유지하면서 PC와 모바일 배너를 따로 설정할 수 있게 하는 방법입니다.
lib/shop.lib/php 파일에
// 배너출력 함수 바로 위에 디바이스 체크 함수를 추가해줍니다.
[code]
function MobileCheck() {
global $HTTP_USER_AGENT;
$MobileArray = array("iphone","lgtelecom","skt","mobile","samsung","nokia","blackberry","android","android","sony","phone");
$checkCount = 0;
for($i=0; $i<sizeof($MobileArray); $i++){
if(preg_match("/$MobileArray[$i]/", strtolower($HTTP_USER_AGENT))){ $checkCount++; break; }
}
return ($checkCount >= 1) ? "Mobile" : "Computer";
}
[/code]
그리고 배너출력 함수를 이렇게 수정해주시면 됩니다.
[code]
function display_banner($position, $skin='')
{
global $g5;
if (!$position) $position = '왼쪽';
if (!$skin) $skin = 'boxbanner.skin.php';
$skin_path = G5_SHOP_SKIN_PATH.'/'.$skin;
if(G5_IS_MOBILE)
$skin_path = G5_MSHOP_SKIN_PATH.'/'.$skin;
if(file_exists($skin_path)) {
// 접속기기
if(MobileCheck() == "Computer")
$sql_device = " and ( bn_device = 'both' or bn_device = 'pc' ) ";
if(MobileCheck() == "Mobile")
$sql_device = " and ( bn_device = 'both' or bn_device = 'mobile' ) ";
// 배너 출력
$sql = " select * from {$g5['g5_shop_banner_table']} where '".G5_TIME_YMDHIS."' between bn_begin_time and bn_end_time $sql_device and bn_position = '$position' order by bn_order, bn_id desc ";
$result = sql_query($sql);
include $skin_path;
} else {
echo '<p>'.str_replace(G5_PATH.'/', '', $skin_path).'파일이 존재하지 않습니다.</p>';
}
}
[/code]
이렇게 하시면 영카트 관리자 페이지 배너관리에서 PC,모바일 구분으로 배너 삽입 가능합니다.
반응형 테마여도 상관없습니다.
반응형을 유지하면서 PC와 모바일 배너를 따로 설정할 수 있게 하는 방법입니다.
lib/shop.lib/php 파일에
// 배너출력 함수 바로 위에 디바이스 체크 함수를 추가해줍니다.
[code]
function MobileCheck() {
global $HTTP_USER_AGENT;
$MobileArray = array("iphone","lgtelecom","skt","mobile","samsung","nokia","blackberry","android","android","sony","phone");
$checkCount = 0;
for($i=0; $i<sizeof($MobileArray); $i++){
if(preg_match("/$MobileArray[$i]/", strtolower($HTTP_USER_AGENT))){ $checkCount++; break; }
}
return ($checkCount >= 1) ? "Mobile" : "Computer";
}
[/code]
그리고 배너출력 함수를 이렇게 수정해주시면 됩니다.
[code]
function display_banner($position, $skin='')
{
global $g5;
if (!$position) $position = '왼쪽';
if (!$skin) $skin = 'boxbanner.skin.php';
$skin_path = G5_SHOP_SKIN_PATH.'/'.$skin;
if(G5_IS_MOBILE)
$skin_path = G5_MSHOP_SKIN_PATH.'/'.$skin;
if(file_exists($skin_path)) {
// 접속기기
if(MobileCheck() == "Computer")
$sql_device = " and ( bn_device = 'both' or bn_device = 'pc' ) ";
if(MobileCheck() == "Mobile")
$sql_device = " and ( bn_device = 'both' or bn_device = 'mobile' ) ";
// 배너 출력
$sql = " select * from {$g5['g5_shop_banner_table']} where '".G5_TIME_YMDHIS."' between bn_begin_time and bn_end_time $sql_device and bn_position = '$position' order by bn_order, bn_id desc ";
$result = sql_query($sql);
include $skin_path;
} else {
echo '<p>'.str_replace(G5_PATH.'/', '', $skin_path).'파일이 존재하지 않습니다.</p>';
}
}
[/code]
이렇게 하시면 영카트 관리자 페이지 배너관리에서 PC,모바일 구분으로 배너 삽입 가능합니다.
반응형 테마여도 상관없습니다.
댓글 15개
게시글 목록
| 번호 | 제목 |
|---|---|
| 2169 | |
| 2168 | |
| 2167 | |
| 2158 | |
| 2146 | |
| 2140 | |
| 2130 | |
| 2114 | |
| 2102 | |
| 2095 | |
| 2084 | |
| 2075 | |
| 2072 | |
| 2070 | |
| 2069 | |
| 2065 | |
| 2058 | |
| 2056 | |
| 2055 | |
| 2054 | |
| 2049 | |
| 2038 | |
| 2036 | |
| 1989 | |
| 1956 | |
| 1923 | |
| 1918 | |
| 1904 | |
| 1892 | |
| 1891 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기