Files
2026-06-11 18:47:38 +09:00

124 lines
5.0 KiB
PHP

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 필수 라이브러리 로드
include_once(G5_THEME_PATH.'/head.sub.php');
include_once(G5_LIB_PATH.'/latest.lib.php');
include_once(G5_LIB_PATH.'/outlogin.lib.php');
include_once(G5_LIB_PATH.'/poll.lib.php');
include_once(G5_LIB_PATH.'/visit.lib.php');
include_once(G5_LIB_PATH.'/connect.lib.php');
include_once(G5_LIB_PATH.'/popular.lib.php');
// 💡 [핵심] 모바일 메뉴 데이터를 가져옵니다.
$menu_tree_mobile = get_menu_db(1, true);
?>
<!-- 모바일 헤더 -->
<header id="mobile-header">
<div class="mobile-header-container">
<a href="<?php echo G5_URL; ?>" class="mobile-logo">
<img src="<?php echo G5_THEME_URL; ?>/images/logo.png" alt="<?php echo $config['cf_title']; ?>">
</a>
<button type="button" id="mobile-menu-open" class="mobile-menu-open-btn" aria-label="전체메뉴 열기">
<i class="fa fa-bars"></i>
</button>
</div>
</header>
<!-- 모바일 네비게이션 패널 -->
<div id="mobile-nav-panel">
<div class="mobile-nav-header">
<?php if (!$is_member) { ?>
<a href="<?php echo G5_BBS_URL ?>/login.php" class="btn-mobile-login">로그인</a>
<a href="<?php echo G5_BBS_URL ?>/register.php" class="btn-mobile-join">회원가입</a>
<?php } else { ?>
<div class="mobile-user-info">
<strong><?php echo $member['mb_nick'] ?></strong> 님, 환영합니다.
</div>
<?php } ?>
<button type="button" id="mobile-menu-close" class="mobile-menu-close-btn" aria-label="전체메뉴 닫기">&times;</button>
</div>
<nav class="mobile-gnb">
<ul>
<?php
foreach ($menu_tree_mobile as $row) {
$has_sub = isset($row['sub']) && !empty($row['sub']);
$href = $row['me_link'];
if (strpos($href, '#') === 0 && strlen($href) > 1) {
$href = G5_URL . $href;
}
?>
<li>
<a href="<?php echo $href; ?>" target="_<?php echo $row['me_target']; ?>">
<?php echo get_text($row['me_name']); ?>
<?php if ($has_sub) echo '<span class="sub-menu-indicator"><i class="fa fa-chevron-down"></i></span>'; ?>
</a>
<?php
if ($has_sub) {
echo '<ul class="sub-menu">';
foreach ($row['sub'] as $row2) {
$href2 = $row2['me_link'];
if (strpos($href2, '#') === 0 && strlen($href2) > 1) {
$href2 = G5_URL . $href2;
}
echo '<li><a href="' . $href2 . '" target="_' . $row2['me_target'] . '">' . get_text($row2['me_name']) . '</a></li>';
}
echo '</ul>';
}
?>
</li>
<?php } ?>
</ul>
</nav>
</div>
<div id="mobile-nav-overlay"></div>
<!-- 💡 [핵심] 모바일 메뉴 제어 스크립트 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
const openBtn = document.getElementById('mobile-menu-open');
const closeBtn = document.getElementById('mobile-menu-close');
const navPanel = document.getElementById('mobile-nav-panel');
const overlay = document.getElementById('mobile-nav-overlay');
const subMenuIndicators = document.querySelectorAll('.sub-menu-indicator');
function openMenu() {
navPanel.classList.add('is-active');
overlay.classList.add('is-active');
document.body.style.overflow = 'hidden';
}
function closeMenu() {
navPanel.classList.remove('is-active');
overlay.classList.remove('is-active');
document.body.style.overflow = '';
}
if (openBtn) openBtn.addEventListener('click', openMenu);
if (closeBtn) closeBtn.addEventListener('click', closeMenu);
if (overlay) overlay.addEventListener('click', closeMenu);
subMenuIndicators.forEach(indicator => {
indicator.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
const subMenu = this.closest('li').querySelector('.sub-menu');
if (subMenu) {
subMenu.style.display = subMenu.style.display === 'block' ? 'none' : 'block';
this.querySelector('i').classList.toggle('fa-chevron-down');
this.querySelector('i').classList.toggle('fa-chevron-up');
}
});
});
});
</script>
<div id="wrapper">
<div id="container">
<?php if (!defined("_INDEX_")) { ?>
<h2 id="container_title" class="top" title="<?php echo get_text($g5['title']); ?>">
<a href="javascript:history.back();"><i class="fa fa-chevron-left" aria-hidden="true"></i><span class="sound_only">뒤로가기</span></a> <?php echo get_head_title($g5['title']); ?>
</h2>
<?php } ?>