레이어팝업 오류 수정부탁드립니다.

레이어팝업 오류 수정부탁드립니다.

QA

레이어팝업 오류 수정부탁드립니다.

본문

http://sir.co.kr/bbs/board.php?bo_table=g4_plugin&wr_id=12693
위 팝업 배너 관리자 스킨을 사용했습니다.
그런데 레이어팝업의 경우 새창 옵션이 적용되지 않아서 질문올립니다 ㅠㅠ
댓글이나 쪽지알려주시면 네이트온 알려드리겠습니다. ㅠㅠ

list_form.php ---------------------------------------
<tr class='ht'>
<td>새창 옵션</td>
<td colspan=3>
    <label><input type=checkbox name="lp_menubar"    value="1" <?=$lp[lp_menubar]   ?"checked='checked'":"";?>> 메뉴바</label> 
<label><input type=checkbox name="lp_toolbar"    value="1" <?=$lp[lp_toolbar]   ?"checked='checked'":"";?>> 툴바</label> 
<label><input type=checkbox name="lp_resizable"  value="1" <?=$lp[lp_resizable] ?"checked='checked'":"";?>> 리사이즈가능</label> 
<label><input type=checkbox name="lp_scrollbars" value="1" <?=$lp[lp_scrollbars]?"checked='checked'":"";?>> 스크롤바</label> 
<label><input type=checkbox name="lp_status"     value="1" <?=$lp[lp_status]    ?"checked='checked'":"";?>> 상태바</label> 
</td>
</tr>
//list_form.php ---------------------------------------


layer.inc.php ---------------------------------------
<?
if (!defined('_GNUBOARD_')) exit;
include_once("$g4[path]/lib/layer.lib.php");

$sql = "select * from  $g4[layer_popup_table] where lp_use = 1 and NOW() between lp_begin_datetime and lp_end_datetime ";    
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
    $lp_id      = $row[lp_id];
    $lp_type    = $row[lp_type];
    $lp_center  = $row[lp_center];

    // 이미 쿠키가 있다면 건너뛴다.
    if ($_COOKIE["ck_lp_id_".$lp_id]) continue;
    
    if ($lp_type == "팝업창") 
    {
        echo "<script type=\"text/javascript\">\n";
        $lp_menubar    = $row[lp_menubar] ? "yes" : "no";
        $lp_toolbar    = $row[lp_toolbar] ? "yes" : "no";
        $lp_scrollbars = $row[lp_scrollbars] ? "yes" : "no";
        $lp_resizable  = $row[lp_resizable] ? "yes" : "no";
        $lp_status     = $row[lp_status] ? "yes" : "no";
    
        $lp_width  = $row[lp_width];
        $lp_height = $row[lp_height];

        if ($lp_center)
        {
            echo  "var left_pos_{$i}=(screen.width-{$lp_width})/2;\n";
            echo  "var top_pos_{$i}=(screen.height-{$lp_height})/2;\n";
            $option = "width=$lp_width,height=$lp_height,left='+left_pos_{$i}+',top='+top_pos_{$i}+',menubar=$lp_menubar,scrollbars=$lp_scrollbars,status=$lp_status,toolbar=$lp_toolbar,resizable=$lp_resizable"; 
        } 
        else
        {
            $option = "width=$lp_width,height=$lp_height,left=$row[lp_left],top=$row[lp_top],menubar=$lp_menubar,scrollbars=$lp_scrollbars,status=$lp_status,toolbar=$lp_toolbar,resizable=$lp_resizable";
        }
    
        echo "window.open('{$g4[path]}/popup_view.php?lp_id=$lp_id','lp_win{$i}','{$option}');"; 
        echo "</script>";
    
    }
    else if ($lp_type == "레이어")
    {
        echo layer_view($lp_id);
    }
}
?>
<script type="text/javascript" src="js/common.js"></script> 

//layer.inc.php ---------------------------------------


layer.lib.php -----------------------------------------------------
<?
if (!defined('_GNUBOARD_')) exit;

function layer_view($lp_id)
{
    global $g4;

    $sql="select * from {$g4[layer_popup_table]} where lp_id=$lp_id ";
    $row=sql_fetch($sql);

    $subject = stripslashes($row[lp_subject]);
    $content = stripslashes($row[lp_content]);
    $gigan   = $row[lp_gigan];

    switch($gigan)
    {
        case 1:  $gigan_text = "하루 동안 보이지 않습니다"; break;
        case 7:  $gigan_text = "일주일 동안 보이지 않습니다"; break;
        case 14: $gigan_text = "2주일 동안 보이지 않습니다"; break;
        case 15: $gigan_text = "보름 동안 보이지 않습니다"; break;
        case 30: $gigan_text = "한달 동안 보이지 않습니다"; break;
        default:
            $gigan_text = $gigan."일 동안 보이지 않습니다";
            break;
    }

    $expire = time() + $gigan * 86400;

    if ($row[lp_type] == "레이어") 
    {
        $s = <<< HEREDOC
            <script type="text/javascript" src="$g4[path]/js/jquery.easydrag.js"></script>
            <script type="text/javascript">
            jQuery.fn.center = function () {     
                this.css("position","absolute");     
                this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");     
                this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");     
                return this; 
            } 

            $(function() { 
                // 레이어 보이면서 드래그 가능하게
                $("#layer_{$lp_id}").show().easydrag(true); 
                // 창닫기
                $("#layer_close_{$lp_id}").bind("click", function() {
                    $("#layer_{$lp_id}").hide();
                });
                // 기간을 클릭하면 쿠키설정하면서 레이어를 감춤 (창닫김 현상)
                $("#gigan").bind("click", function() {
                    if (this.checked) {
                        set_cookie("ck_lp_id_{$lp_id}", 1, {$expire});
                        $("#layer_{$lp_id}").hide();
                    }
                });
                // 레이어를 중앙으로
                if ($row[lp_center]) {
                    $("#layer_{$lp_id}").center();
                }
            });
            </script>

            <div id="layer_{$lp_id}" style=" z-index:9999;position:absolute; display:none; top:{$row[lp_top]}px; left:{$row[lp_left]}px; width:{$row[lp_width]}px; height:{$row[lp_height]}px; background-color:#ffffff;">
            <table border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
            <tr>
                <td colspan=2 height=30 bgcolor="#b5b5b5"> <span style=" font-weight:bold;color:#666;padding-left:12px; padding-right:-12px;">{$subject}</span></td>
            </tr>
            <tr valign=top>
                <td colspan=2>
                    <table border=0 cellpadding=0 cellspacing=0 width="{$row[lp_width]}" >
                    <tr>
                        <td valign=top style="padding-top:20px; padding-left:12px; padding-right:-12px;">{$content}</td>
                    </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td height=30 bgcolor=#b5b5b5>
                    <div style="float:left; color:#666;">
                          <label><input type=checkbox id="gigan" value="{$gigan}">  {$gigan_text}</label>
                    </div>
                    <div style="float:right; color:#666;">
                        <button id="layer_close_{$lp_id}">창닫기</button>  
                    </div>
                </td>
            </tr>
            </table>
            </div>
HEREDOC;
    }
    else 
    { 
    // 팝업창 
    $s = <<< HEREDOC
        <table border=0 cellpadding=0 cellspacing=0 width=100% height=100% >
        <tr>
            <td valign=top height=100%>{$content}</td>
        </tr>
        <tr>
            <td height=30 bgcolor=#b5b5b5>
                <div style="float:left; color:#666;">
                      <label><input type=checkbox id="gigan" value="{$gigan}">{$gigan_text}</label>
                </div>
        </tr>
        </table>

        <script type="text/javascript">
        $(function() {
            $("#gigan").bind("click", function() {
                if (this.checked) {
                    set_cookie("ck_lp_id_{$lp_id}", 1, {$expire});
                    self.close();
                }
            });
        });
        </script>
HEREDOC;
    } 
// 팝업창 끝

    return $s;
}
?>

// layer.lib.php -----------------------------------------------------

이 질문에 댓글 쓰기 :

답변 2

테스트 해보니 무리없이 잘되는데요?
혹시 브라우저의 팝업창이 차단되어 있는건아니신지..
답변을 작성하시기 전에 로그인 해주세요.
전체 73
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT