팝업창 질문입니다
본문
홈페이지에 팝업창이 갑자기 안나오는데 어떤문제인지...모르겠어서 질문올려요
관리자모드에서 팝업레이어관리에서 등록해서 올리는 방식입니다.
소스코드
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$sql = " select * from {$g5['new_win_table']}
where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time
and nw_device IN ( 'both', 'pc' )
order by nw_id asc ";
$result = sql_query($sql, false);
?>
<style>
.hd_pop_bg{background: rgba(0,0,0,0.5);
width: 100vw;
height: 100vh;}
</style>
<!-- 팝업레이어 시작 { -->
<div id="hd_pop">
<h2>팝업레이어 알림</h2>
<?php
for ($i=0; $nw=sql_fetch_array($result); $i++)
{
// 이미 체크 되었다면 Continue
if ($_COOKIE["hd_pops_{$nw['nw_id']}"])
continue;
?>
<div id="hd_pops_<?php echo $nw['nw_id'] ?>" class="hd_pops" style="top:<?php echo $nw['nw_top']?>px;left:<?php echo $nw['nw_left']?>px">
<div class="hd_pops_con" style="width:<?php echo $nw['nw_width'] ?>px;height:<?php echo $nw['nw_height'] ?>px">
<?php echo conv_content($nw['nw_content'], 1); ?>
</div>
<div class="hd_pops_footer">
<button class="hd_pops_reject hd_pops_<?php echo $nw['nw_id']; ?> <?php echo $nw['nw_disable_hours']; ?>"><strong><?php echo $nw['nw_disable_hours']; ?></strong>시간 동안 다시 열람하지 않습니다.</button>
<button class="hd_pops_close hd_pops_<?php echo $nw['nw_id']; ?>">닫기</button>
</div>
</div>
<div class="hd_pop_bg hd_pops_<?php echo $nw['nw_id'] ?>"></div>
<?php }
if ($i == 0) echo '<span class="sound_only">팝업레이어 알림이 없습니다.</span>';
?>
</div>
<script>
$(function() {
$(".hd_pops_reject").click(function() {
var id = $(this).attr('class').split(' ');
var ck_name = id[1];
var exp_time = parseInt(id[2]);
$("#"+id[1]).css("display", "none");
set_cookie(ck_name, 1, exp_time, g5_cookie_domain);
});
$('.hd_pops_close').click(function() {
var idb = $(this).attr('class').split(' ');
$('#'+idb[1]).css('display','none');
$('.hd_pop_bg').css('display','none');
});
$("#hd").css("z-index", 1000);
});
</script>
<!-- } 팝업레이어 끝 -->
테마 index.php 상단에도
include_once(G5_THEME_PATH . '/head.php');
include G5_BBS_PATH . '/newwin.inc.php'; // 팝업레이어
이렇게 되어 있습니다..
홈페이지 F12개발자 모드로 팝업창을 봤을때는
<span class="sound_only">팝업레이어 알림이 없습니다.</span> 이부분만 출력되구요
관리모드에서 팝업창 날짜도 모두 문제 없는상태입니다
답변 2
$sql = " select * from {$g5['new_win_table']}
where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time
and nw_device IN ( 'both', 'pc' )
order by nw_id asc ";
$result = sql_query($sql, false);
echo $sql;
sql문을 출력하여 DB에 직접 쿼리해보면서 https://sir.kr/g5_tip/15716
문제점을 찾아나갈 수 있습니다.
$sql = " select * from {$g5['new_win_table']}
where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time
and nw_device IN ( 'both', 'pc' )
order by nw_id asc ";
등록한 팝업이 있고
날짜가 맞고
디바이스 지정이 맞다면 나와야 정상일 텐데요.