first commit 2
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
/**
|
||||
* rb.mod.banner :: split_layout/banner.skin.php
|
||||
* 배너 그룹 스킨 (래퍼)
|
||||
*/
|
||||
|
||||
// CSS 로드
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_URL.'/rb/rb.mod/banner/skin/split_layout/style.css">', 0);
|
||||
|
||||
// 배너 목록이 있으면 루프를 돌며 skin.php를 include
|
||||
if (isset($banners) && is_array($banners)) {
|
||||
foreach ($banners as $banner) {
|
||||
include(dirname(__FILE__).'/skin.php');
|
||||
}
|
||||
} else if (isset($banner)) {
|
||||
// 단일 배너인 경우
|
||||
include(dirname(__FILE__).'/skin.php');
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
/**
|
||||
* rb.mod.banner :: split_layout/skin.php
|
||||
* 단일 배너 아이템 스킨 (내용에 따라 3단 변신)
|
||||
*/
|
||||
|
||||
// 이미지와 텍스트 유무 확인
|
||||
$has_image = (isset($banner['bn_img']) && !empty($banner['bn_img']));
|
||||
$has_text = (isset($banner['bn_alt']) && !empty($banner['bn_alt']));
|
||||
|
||||
// 클래스 동적 생성
|
||||
$layout_class = '';
|
||||
if ($has_image && $has_text) {
|
||||
$layout_class = 'has-image-and-text';
|
||||
} elseif ($has_image) {
|
||||
$layout_class = 'has-image-only';
|
||||
} elseif ($has_text) {
|
||||
$layout_class = 'has-text-only';
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" href="<?php echo G5_URL; ?>/rb/rb.mod/banner/skin/split_layout/style.css?ver=<?php echo G5_SERVER_TIME; ?>">
|
||||
<div class="rb-banner-split-layout <?php echo $layout_class; ?>">
|
||||
<a href="<?php echo $banner['bn_url']; ?>"
|
||||
target="_<?php echo $banner['bn_new_win'] ? 'blank' : 'self'; ?>"
|
||||
onclick="banner_click_count(this); return true;"
|
||||
data-banner-id="<?php echo $banner['bn_id']; ?>">
|
||||
<?php if ($has_image): ?>
|
||||
<div class="banner-image">
|
||||
<?php echo $banner['bn_img']; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($has_text): ?>
|
||||
<div class="banner-content">
|
||||
<h3><?php echo get_text($banner['bn_alt']); ?></h3>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
@@ -0,0 +1,110 @@
|
||||
/* ================================
|
||||
0. 배너 고정 크기 (절대 필수)
|
||||
================================ */
|
||||
.banner-unit-wrapper {
|
||||
width: 180px;
|
||||
height: 80px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ================================
|
||||
1. 링크 전체 채우기
|
||||
================================ */
|
||||
.rb-banner-split-layout a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
border: 1px solid #eee;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ================================
|
||||
2. 이미지 영역 (flex 문제 해결)
|
||||
================================ */
|
||||
.banner-image {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
background: #f8f8f8;
|
||||
min-height: 0; /* 🔥 flex 기본값 무력화 */
|
||||
}
|
||||
|
||||
.banner-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* ================================
|
||||
3. 이미지 + 텍스트
|
||||
================================ */
|
||||
.has-image-and-text .banner-image {
|
||||
flex: 0 0 60px; /* 🔥 이게 핵심 */
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.has-image-and-text .banner-content {
|
||||
flex: 0 0 20px;
|
||||
height: 20px;
|
||||
border-top: 1px solid #eee;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.has-image-and-text .banner-content h3 {
|
||||
margin: 0;
|
||||
font-size: 11px;
|
||||
line-height: 20px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* ================================
|
||||
4. 이미지만
|
||||
================================ */
|
||||
.has-image-only .banner-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/*object-fit: fill;*/
|
||||
max-height: 85px;
|
||||
}
|
||||
.banner-image img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: fill;
|
||||
max-height: 85px;
|
||||
}
|
||||
|
||||
.has-image-only .banner-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ================================
|
||||
5. 텍스트만
|
||||
================================ */
|
||||
.has-text-only .banner-image {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.has-text-only .banner-content {
|
||||
flex: 0 0 100%;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.has-text-only .banner-content h3 {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
Reference in New Issue
Block a user