290 lines
14 KiB
PHP
290 lines
14 KiB
PHP
<?php
|
|
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
|
|
|
global $row_mod, $rb_module_table;
|
|
$rb_skin = sql_fetch (" select * from {$rb_module_table} where md_id = '{$row_mod['md_id']}' "); //환경설정 테이블 조회 (삭제금지)
|
|
$md_banner_bg = isset($rb_skin['md_banner_bg']) ? $rb_skin['md_banner_bg'] : '';
|
|
|
|
?>
|
|
|
|
<style>
|
|
.swiper-wrapper-slide_wide_bn {text-align: left;}
|
|
.swiper-button-next-wide {right:auto; left: 50px !important; opacity: 1 !important; top:7px !important}
|
|
.swiper-button-prev-wide {left:-10px; top:7px !important}
|
|
.sl_bn_inner {min-height: 800px; background-repeat: no-repeat; background-position: center center; background-size: cover; position: relative;}
|
|
.sl_overlay {position: absolute;top: 0; left: 0;width: 100%; height: 100%; /*background: rgba(0, 0, 0, 0.1); */z-index: 1;}
|
|
.sl_content {position: absolute; bottom:0px; left: 0px; z-index: 2; color:#fff; left: 50%; transform: translateX(-50%); padding-bottom: 100px;}
|
|
.swiper-pagination-wide-page {text-align: center; width: 70px !important; float:left; font-size: 12px;}
|
|
.sl_arrows {margin-bottom: 100px;}
|
|
.sl_dates {font-size: 16px; margin-bottom: 30px;}
|
|
.sl_dates span {background-color: rgba(0,0,0,0.6); padding: 10px 15px; border-radius: 10px;}
|
|
.sl_alt1 {font-size: 60px; line-height: 140%; color:#fff; text-shadow: 0px 0px 20px rgba(0,0,0,0.5);}
|
|
.sl_alt2 {font-size: 22px; line-height: 100%; color:#fff; text-shadow: 0px 0px 10px rgba(0,0,0,0.7);}
|
|
.sl_a_links {font-size: 20px; padding: 15px 30px; border-radius: 10px; background-color: #FAE100; color:#483729; line-height: 100%; margin-top: 40px; float:left;}
|
|
.ico_j {float:right; margin-top: -80px; filter: drop-shadow(0px 0px 5px rgba(0,0,0,0.4));}
|
|
.ico_j img {height:90px; width: 90px;}
|
|
.ico_j_ul1 {float: left; font-size: 20px; font-weight: 900; margin-top: 17px; /*text-shadow: 0px 0px 20px rgba(0,0,0,0.5);*/}
|
|
.ico_j_ul1 span {font-size: 40px;}
|
|
.ico_j_ul2 {float:right; padding-left: 10px;}
|
|
.image_roll {object-fit: cover; height:800px !important; width: 100%; position: absolute; top:0px; left: 0px;}
|
|
|
|
@media all and (max-width:1400px) {
|
|
.sl_content {width: 100%; left: 0px; transform: none;}
|
|
.swiper-button-prev-wide {left: 10px;}
|
|
.swiper-button-next-wide svg {width: 10px;}
|
|
.swiper-button-prev-wide svg {width: 10px;}
|
|
.rb_wide_bn_wrap {padding: 0px;}
|
|
.swiper-button-next-wide {right:auto; left: 73px !important;}
|
|
.sl_a_links {font-size: 18px;}
|
|
.ico_j {float:none; position: absolute; top:-150px; right:0px; margin-right: 10px;}
|
|
}
|
|
</style>
|
|
|
|
<?php
|
|
$i = 0; // $i 변수를 초기화
|
|
|
|
while ($row = sql_fetch_array($result)) {
|
|
global $config;
|
|
|
|
$bn_border = isset($row['bn_border']) && $row['bn_border'] ? ' bn_border' : '';
|
|
$bn_radius = isset($row['bn_radius']) && $row['bn_radius'] ? ' bn_radius' : '';
|
|
$bn_image = G5_DATA_URL.'/banners/'.$row['bn_id'];
|
|
$bn_content_type = isset($row['bn_content_type']) ? $row['bn_content_type'] : 'image';
|
|
$bn_video_url = isset($row['bn_video_url']) ? $row['bn_video_url'] : '';
|
|
$bn_youtube_url = isset($row['bn_youtube_url']) ? $row['bn_youtube_url'] : '';
|
|
$bn_vimeo_url = isset($row['bn_vimeo_url']) ? $row['bn_vimeo_url'] : '';
|
|
|
|
// 새창 옵션
|
|
$bn_new_win = isset($row['bn_new_win']) && $row['bn_new_win'] ? ' target="_blank"' : '';
|
|
|
|
// 콘텐츠 파일 존재 여부 확인
|
|
$bimg = G5_DATA_PATH.'/banners/'.$row['bn_id'];
|
|
$file_exists = file_exists($bimg);
|
|
|
|
// 콘텐츠 유형별 출력 가능 여부 확인
|
|
$can_display = false;
|
|
if ($bn_content_type === 'image' && $file_exists) {
|
|
$can_display = true;
|
|
} elseif ($bn_content_type === 'video' && $file_exists) {
|
|
$can_display = true;
|
|
} elseif ($bn_content_type === 'video_url' && !empty($bn_video_url)) {
|
|
$can_display = true;
|
|
} elseif ($bn_content_type === 'youtube' && !empty($bn_youtube_url)) {
|
|
$can_display = true;
|
|
} elseif ($bn_content_type === 'vimeo' && !empty($bn_vimeo_url)) {
|
|
$can_display = true;
|
|
}
|
|
|
|
// 출력 가능한 배너만 처리
|
|
if ($can_display) {
|
|
if ($i == 0) echo '<div class="mod_bn_wrap rb_wide_bn_wrap rb_wide_bn_'.$row_mod['md_id'].'" style="background-color:'.$md_banner_bg.'"><div class="swiper-container swiper-container-slide_wide_bn_'.$row_mod['md_id'].'"><ul class="swiper-wrapper swiper-wrapper-slide_wide_bn swiper-wrapper-slide_wide_bn_'.$row_mod['md_id'].'">'.PHP_EOL;
|
|
|
|
echo '<div class="swiper-slide swiper-slide-slide_wide_bn_'.$row_mod['md_id'].' slide_item top_ad">'.PHP_EOL;
|
|
|
|
echo '<div class="sl_bn_inner">'.PHP_EOL;
|
|
|
|
// 콘텐츠 유형별 렌더링
|
|
if ($bn_content_type === 'image') {
|
|
echo '<img src="'.$bn_image.'" class="image_roll">'.PHP_EOL;
|
|
} elseif ($bn_content_type === 'video') {
|
|
// 로컬 업로드 동영상
|
|
echo '<video class="image_roll" autoplay muted playsinline loop controls style="width: 100%; height: 100%; object-fit: cover;">'.PHP_EOL;
|
|
echo ' <source src="'.$bn_image.'" type="video/mp4">'.PHP_EOL;
|
|
echo ' Your browser does not support the video tag.'.PHP_EOL;
|
|
echo '</video>'.PHP_EOL;
|
|
} elseif ($bn_content_type === 'video_url') {
|
|
// 외부 비디오 URL (MP4, M3U8 등)
|
|
echo '<video class="image_roll" autoplay muted playsinline loop controls style="width: 100%; height: 100%; object-fit: cover;">'.PHP_EOL;
|
|
echo ' <source src="'.$bn_video_url.'" type="application/x-mpegURL">'.PHP_EOL;
|
|
echo ' <source src="'.$bn_video_url.'" type="video/mp4">'.PHP_EOL;
|
|
echo ' Your browser does not support the video tag.'.PHP_EOL;
|
|
echo '</video>'.PHP_EOL;
|
|
} elseif ($bn_content_type === 'youtube') {
|
|
// 유튜브 embed URL 변환
|
|
$youtube_embed_url = '';
|
|
if (preg_match('/youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/', $bn_youtube_url, $match)) {
|
|
$youtube_embed_url = 'https://www.youtube.com/embed/' . $match[1];
|
|
} elseif (preg_match('/youtu\.be\/([a-zA-Z0-9_-]+)/', $bn_youtube_url, $match)) {
|
|
$youtube_embed_url = 'https://www.youtube.com/embed/' . $match[1];
|
|
} else {
|
|
$youtube_embed_url = $bn_youtube_url;
|
|
}
|
|
echo '<iframe class="image_roll" style="width: 100%; height: 100%; border: none;" src="'.$youtube_embed_url.'" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'.PHP_EOL;
|
|
} elseif ($bn_content_type === 'vimeo') {
|
|
// 비메오 embed URL 변환
|
|
$vimeo_embed_url = '';
|
|
if (preg_match('/vimeo\.com\/(\d+)/', $bn_vimeo_url, $match)) {
|
|
$vimeo_embed_url = 'https://player.vimeo.com/video/' . $match[1];
|
|
} else {
|
|
$vimeo_embed_url = $bn_vimeo_url;
|
|
}
|
|
echo '<iframe class="image_roll" style="width: 100%; height: 100%; border: none;" src="'.$vimeo_embed_url.'" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>'.PHP_EOL;
|
|
} elseif ($bn_content_type === 'link') {
|
|
// 외부 영상 링크 (MP4, M3U8, 스트리밍 URL 등)
|
|
echo '<video class="image_roll" autoplay muted playsinline loop controls style="width: 100%; height: 100%; object-fit: cover;">'.PHP_EOL;
|
|
echo ' <source src="'.$bn_video_url.'" type="application/x-mpegURL">'.PHP_EOL;
|
|
echo ' <source src="'.$bn_video_url.'" type="video/mp4">'.PHP_EOL;
|
|
echo ' Your browser does not support the video tag.'.PHP_EOL;
|
|
echo '</video>'.PHP_EOL;
|
|
}
|
|
|
|
echo '<div class="sl_overlay"></div>'.PHP_EOL;
|
|
echo '<div class="sl_content" style="width:'.$rb_core['main_width'].'px">'.PHP_EOL;
|
|
|
|
echo '
|
|
<div class="sl_arrows">
|
|
<div class="swiper-button-next swiper-button-next-wide swiper-button-next-wide_'.$row_mod['md_id'].'">
|
|
<svg width="10" height="16" viewBox="0 0 24 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M1 45L22.3333 23L1 1" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
</svg>
|
|
</div>
|
|
<div class="swiper-pagination-fraction swiper-pagination-wide-page swiper-pagination-wide_'.$row_mod['md_id'].'"></div>
|
|
<div class="swiper-button-prev swiper-button-prev-wide swiper-button-prev-wide_'.$row_mod['md_id'].'">
|
|
<svg width="10" height="16" viewBox="0 0 24 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M23 0.999999L1.66667 23L23 45" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
</svg>
|
|
</div>
|
|
<div class="cb"></div>
|
|
</div>'.PHP_EOL;
|
|
|
|
if(isset($row['bn_alt3']) && $row['bn_alt3']) {
|
|
echo '<div class="sl_dates font-R"><span>'.$row['bn_alt3'].'</span></div>'.PHP_EOL;
|
|
}
|
|
if(isset($row['bn_alt']) && $row['bn_alt']) {
|
|
echo '<div class="sl_alt1 font-B"><span>'.$row['bn_alt'].'</span></div>'.PHP_EOL;
|
|
}
|
|
if(isset($row['bn_alt2']) && $row['bn_alt2']) {
|
|
echo '<div class="sl_alt2 font-R"><span>'.$row['bn_alt2'].'</span></div>'.PHP_EOL;
|
|
}
|
|
|
|
// 배너 링크 처리
|
|
$banner = '';
|
|
if(isset($row['bn_url']) && $row['bn_url']) {
|
|
if ($row['bn_url'][0] == '#') {
|
|
$banner .= '<a href="'.$row['bn_url'].'" class="sl_a_links font-B">';
|
|
if(isset($row['bn_alt4']) && $row['bn_alt4']) {
|
|
$banner .= $row['bn_alt4'].'</a>'.PHP_EOL;
|
|
} else {
|
|
$banner .= '자세히 보기</a>'.PHP_EOL;
|
|
}
|
|
} else if ($row['bn_url'] && $row['bn_url'] != 'http://') {
|
|
$banner .= '<a href="'.G5_URL.'/rb/rb.mod/banner/bannerhit.php?bn_id='.$row['bn_id'].'"'.$bn_new_win.' class="sl_a_links font-B">';
|
|
if(isset($row['bn_alt4']) && $row['bn_alt4']) {
|
|
$banner .= $row['bn_alt4'].'</a>'.PHP_EOL;
|
|
} else {
|
|
$banner .= '자세히 보기</a>'.PHP_EOL;
|
|
}
|
|
}
|
|
}
|
|
|
|
if($banner) {
|
|
echo $banner;
|
|
echo '<div class="cb"></div>'.PHP_EOL;
|
|
}
|
|
|
|
echo '<div class="ico_j"><ul class="ico_j_ul1">'.PHP_EOL;
|
|
|
|
if(isset($config['cf_1']) && $config['cf_1']) {
|
|
echo '<li>'.$config['cf_1_subj'].'</li>'.PHP_EOL;
|
|
}
|
|
if(isset($config['cf_1']) && $config['cf_1']) {
|
|
echo '<li><span class="font-B">'.$config['cf_1'].'</span></li>'.PHP_EOL;
|
|
}
|
|
|
|
echo '</ul><ul class="ico_j_ul2"><img src="'.G5_THEME_URL.'/rb.img/ico_j.svg"></ul></div>'.PHP_EOL;
|
|
|
|
|
|
echo '</div>'.PHP_EOL; // sl_content 닫기
|
|
echo '</div>'.PHP_EOL; // sl_bn_inner 닫기
|
|
echo '</div>'.PHP_EOL; // swiper-slide 닫기
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
if ($i > 0) echo '</ul>';
|
|
|
|
|
|
|
|
if ($i > 0) echo '</div></div>';
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var swiper = new Swiper('.swiper-container-slide_wide_bn_<?php echo $row_mod['md_id'] ?>', {
|
|
slidesPerView: 1,
|
|
spaceBetween: 0,
|
|
observer: true,
|
|
observeParents: true,
|
|
autoHeight: true,
|
|
<?php if ($i > 1) { ?>
|
|
touchRatio: 1,
|
|
loop: true,
|
|
<?php } else { ?>
|
|
touchRatio: 0,
|
|
loop: false,
|
|
<?php } ?>
|
|
|
|
navigation: {
|
|
nextEl: '.swiper-button-next-wide_<?php echo $row_mod['md_id'] ?>',
|
|
prevEl: '.swiper-button-prev-wide_<?php echo $row_mod['md_id'] ?>',
|
|
},
|
|
|
|
pagination: {
|
|
el: '.swiper-pagination-wide_<?php echo $row_mod['md_id'] ?>',
|
|
type: 'fraction', // ← 핵심
|
|
formatFractionCurrent: function (number) {
|
|
return number;
|
|
},
|
|
formatFractionTotal: function (number) {
|
|
return number;
|
|
},
|
|
},
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
|
//부모 width를 무시하고 div 를 100%로 만들고, 모듈설정 버튼의 100% 처리를 위해 스크립트를 사용 합니다.
|
|
//복제 사용을 위해 $row_mod['md_id'](모듈ID) 를 활용 합니다.
|
|
|
|
function adjustDivWidth_<?php echo $row_mod['md_id'] ?>() {
|
|
const content_w = $('.rb_wide_bn_<?php echo $row_mod['md_id'] ?>');
|
|
const firstAdminOv_w = content_w.nextUntil('.admin_ov').next('.admin_ov');
|
|
|
|
if ($(window).width() > <?php echo $rb_core['main_width'] ?>) {
|
|
content_w.css({
|
|
'width': '100vw',
|
|
'position': 'relative',
|
|
'left': '50%',
|
|
'transform': 'translateX(-50%)'
|
|
});
|
|
firstAdminOv_w.css({
|
|
'width': '100vw',
|
|
'left': '50%',
|
|
'transform': 'translateX(-50%)'
|
|
});
|
|
} else {
|
|
content_w.css({
|
|
'width': '100%',
|
|
'position': 'static',
|
|
'left': '0',
|
|
'transform': 'none'
|
|
});
|
|
firstAdminOv_w.css({
|
|
'width': '100%',
|
|
'left': '0',
|
|
'transform': 'none'
|
|
});
|
|
}
|
|
}
|
|
|
|
$(document).ready(adjustDivWidth_<?php echo $row_mod['md_id'] ?>);
|
|
$(window).resize(adjustDivWidth_<?php echo $row_mod['md_id'] ?>);
|
|
|
|
</script>
|