테스트 사이트 - 개발 중인 베타 버전입니다

모바일에도 배너 기능 넣기

· 11년 전 · 6666 · 2
배너관리기능을 모바일에도 적용하는 방법입니다.(단순 복붙팁입니다)

1. /skin/shop/mainbanner.10.skin.php 파일을 /mobile/skin/shop/mainbanner.10.skin.php 로 복사

2. /mobile/skin/shop/mainbanner.10.skin.php 파일 상단에 있는 add_stylesheet 주석처리
//add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">', 0);

3. /mobile/skin/shop/style.css 에 배너 관련 css추가(/skin/shop/style.css 파일 참고)
/* aside:배너 */
.sbn {margin:0 0 5px}
.sbn h2 {position:absolute;font-size:0;line-height:0;overflow:hidden}
.sbn ul {margin:0;padding:0;border:0;list-style:none}
.sbn li {margin:0 0 1px}
.sbn .sbn_border {border:1px solid #d5d5d5} /* 인덱스 배너도 함께 사용 */

#sbn_idx {position:relative;margin:0}
#sbn_idx .sbn_btn {z-index:100;position:absolute;top:50%}
#sbn_idx .sbn_btn button {position:relative;top:-35px;margin:0;padding:0;width:70px;height:70px;border:0;background:transparent;overflow:hidden}
#sbn_idx .sbn_btn span {display:block;width:100%;height:100%;background:url('img/sbn_btn.png')}
#sbn_idx #sbn_btn_p {left:25px}
#sbn_idx .sbn_btn #sbn_btn_prev span {background-position:0 0}
#sbn_idx #sbn_btn_n {right:25px}
#sbn_idx .sbn_btn #sbn_btn_next span {background-position:-70px 0}
#sbn_idx ul {position:relative;overflow:hidden}
#sbn_idx ul li {position:absolute;display:none;top:0;left:0}
#sbn_idx ul li.sbn_first{display:block}

4. /adm/shop_admin/bannerform.php 파일 85라인 select에 모바일 추가
<select name="bn_position" id="bn_position">
<option value="왼쪽" <?php echo get_selected($bn['bn_position'], '왼쪽'); ?>>왼쪽</option>
<option value="메인" <?php echo get_selected($bn['bn_position'], '메인'); ?>>메인</option>
<option value="모바일메인" <?php echo get_selected($bn['bn_position'], '모바일메인'); ?>>모바일메인</option>
</select>

5. /mobile/shop/index.php 파일 상단에 배너 출력 함수 추가
// 배너출력
function display_banner_mobile($position, $skin='')
{
global $g5;

if (!$position) $position = '모바일메인';
if (!$skin) $skin = 'boxbanner.skin.php';

$skin_path = G5_MSHOP_SKIN_PATH.'/'.$skin;

if(file_exists($skin_path)) {
// 배너 출력
$sql = " select * from {$g5['g5_shop_banner_table']} where '".G5_TIME_YMDHIS."' between bn_begin_time and bn_end_time 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>';
}
}

6. 마지막으로 배너 뿌려줄 위치에 아래처럼 적으면 됩니다.(/mobile/shop/index.php)
<?php echo display_banner_mobile('모바일메인', 'mainbanner.10.skin.php'); ?>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 2개

5.0.24에 적용했는데 안먹히네요...ㅠㅠ
8년 전
감사^^

게시글 목록

번호 제목
404
399
391
386
384
383
382
378
377
373
372
362
361
353
345
334
329
307
304
299
295
292
288
272
270
267
263
261
254
252