메인 최근게시물 스크롤 창에 자바에러 방지하기 > 제나플러스

본문 바로가기
사이트 내 전체검색

제나플러스

메인 최근게시물 스크롤 창에 자바에러 방지하기

페이지 정보

본문

게시물 제목 에 ' 를 적을 경우 메인 최근게시물 스크롤 창에 자바에러가 나옵니다.
해결방법은 아래의 설명을 참조하세요.

skin/latest/scroll/latest.skin.php 에서 뿌려줄 리스트 데이타를
addslashes 시켜주면 해결이 됩니다.

아래의 코드를 추가함
      $list[$i][gr_subject] =addslashes($list[$i][gr_subject]);
      $list[$i][bo_subject] =addslashes($list[$i][bo_subject]);
      $list[$i][wr_subject] =addslashes($list[$i][wr_subject]);


위코드를 추가한 전체소스의 모습 skin/latest/scroll/latest.skin.php

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

// 위로 스크롤되는 최신글

// 사용법 :
// 스킨, 게시판아이디, 출력라인, 글자수, "몇개라인,라인높이"
// latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")

// $rows(출력라인)는 $line_mod의 2의 배수 이상으로 설정하셔야 합니다.

// 유니크 값 (최신글은 한페이지에 여러개 둘 수 있으므로... 자바스크립트에서 함수, 변수 충돌을 방지)
$uni = md5(uniqid(rand(), true));

list($line_mod, $height) = explode(",", $options);

$box_height = (int)$line_mod * (int)$height;
?>

<table width=100% cellpadding=0 cellspacing=0 border=0>
<colgroup width=14>
<colgroup>
<colgroup width=37>
<colgroup width=14>
<tr><td>
<table width=445 cellpadding=0 cellspacing=0 bgcolor=#E2E8FD>
<tr><td width=400 height=30>&nbsp;&nbsp;&nbsp;<a href="./bbs/new.php"><b>최근게시물</b></a> &nbsp;&nbsp;<font color="gray">
<?// $my[time_Hms] = date("H시 i분 s초",time());  echo("$my[time_Hms]"); ?>

<?
$a = date ("Y년 m월 j일");
$today = date("w");

if($today == 0) $day = "(일)";
else if($today == 1) $day = "(월)";
else if($today == 2) $day = "(화)";
else if($today == 3) $day = "(수)";
else if($today == 4) $day = "(목)";
else if($today == 5) $day = "(금)";
else if($today == 6) $day = "(토)";

echo "$a $day";
?>&nbsp;
<? $my[time_Hms] = date("H시 i분 s초",time());  echo("$my[time_Hms]"); ?></font></td>





<td></td></tr>
<tr><td colspan=2 align=center><table id=new_all width=95% cellpadding=0 cellspacing=0 bgcolor=#FFFFFF><tr><td style='padding:4px;'>
                <nobr style='display:block; overflow:hidden; width:400;'>


<? if (count($list) == 0) { ?>
    <tr><td colspan=4 align=center height=50>게시물이 없습니다.</td></tr>
<? } else { ?>

    <script language="javascript">
    var roll_height_<?=$uni?> = <?=$box_height?>;
    var total_area_<?=$uni?> = 0;
    var wait_flag_<?=$uni?> = true;

    var bMouseOver_<?=$uni?> = 1;
    var roll_speed_<?=$uni?> = 1;
    var waitingtime_<?=$uni?> = 3000;
    var s_tmp_<?=$uni?> = 0;
    var s_amount_<?=$uni?> = <?=(int)$height?>;
    var roll_text_<?=$uni?> = new Array();
    var startPanel_<?=$uni?> = 0;
    var n_panel_<?=$uni?> = 0;
    var i_<?=$uni?> = 0;

    function start_roll_<?=$uni?>()
    {
        i_<?=$uni?> = 0;
        for (i_<?=$uni?> in roll_text_<?=$uni?>)
            n_panel_<?=$uni?>++;

        n_panel_<?=$uni?> = n_panel_<?=$uni?> -1 ;
        startPanel_<?=$uni?> = Math.round(Math.random()*n_panel_<?=$uni?>);
        if(startPanel_<?=$uni?> == 0) {
            i_<?=$uni?> = 0;
            for (i_<?=$uni?> in roll_text_<?=$uni?>)
                insert_area_<?=$uni?>(total_area_<?=$uni?>, total_area_<?=$uni?>++);
        } else if(startPanel_<?=$uni?> == n_panel_<?=$uni?>) {
            insert_area_<?=$uni?>(startPanel_<?=$uni?>, total_area_<?=$uni?>);
            total_area_<?=$uni?>++;
            for (i_<?=$uni?>=0; i_<?=$uni?><startPanel_<?=$uni?>; i_<?=$uni?>++) {
                insert_area_<?=$uni?>(i_<?=$uni?>, total_area_<?=$uni?>);
                total_area_<?=$uni?>++;
            }
        } else if((startPanel_<?=$uni?> > 0) || (startPanel_<?=$uni?> < n_panel_<?=$uni?>)) {
            insert_area_<?=$uni?>(startPanel_<?=$uni?>, total_area_<?=$uni?>);
            total_area_<?=$uni?>++;
            for (i_<?=$uni?>=startPanel_<?=$uni?>+1; i_<?=$uni?><=n_panel_<?=$uni?>; i_<?=$uni?>++) {
                insert_area_<?=$uni?>(i_<?=$uni?>, total_area_<?=$uni?>);
                total_area_<?=$uni?>++;
            }
            for (i_<?=$uni?>=0; i_<?=$uni?><startPanel_<?=$uni?>; i_<?=$uni?>++) {
                insert_area_<?=$uni?>(i_<?=$uni?>, total_area_<?=$uni?>);
                total_area_<?=$uni?>++;
            }
        }
     
        if ( navigator.appName == "Microsoft Internet Explorer" ) {
            if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 )
            return ;
        }
        window.setTimeout("rolling_<?=$uni?>()",waitingtime_<?=$uni?>);
    }

    function rolling_<?=$uni?>()
    {
        if (bMouseOver_<?=$uni?> && wait_flag_<?=$uni?>) {
            for (i_<?=$uni?>=0;i_<?=$uni?><total_area_<?=$uni?>;i_<?=$uni?>++) {
                tmp_<?=$uni?> = document.getElementById('scroll_area_<?=$uni?>'+i_<?=$uni?>).style;
                tmp_<?=$uni?>.top = parseInt(tmp_<?=$uni?>.top)-roll_speed_<?=$uni?>;
               
                if (parseInt(tmp_<?=$uni?>.top) <= -roll_height_<?=$uni?>) {
                    tmp_<?=$uni?>.top = roll_height_<?=$uni?>*(total_area_<?=$uni?>-1);
                }
               
                if (s_tmp_<?=$uni?>++ > (s_amount_<?=$uni?>-1)*roll_text_<?=$uni?>.length) {
                    wait_flag_<?=$uni?>=false;
                    window.setTimeout("wait_flag_<?=$uni?>=true;s_tmp_<?=$uni?>=0;",waitingtime_<?=$uni?>);
                }
            }
        }
        window.setTimeout("rolling_<?=$uni?>()", 1);
    }

    function insert_area_<?=$uni?>(idx_<?=$uni?>, n_<?=$uni?>)
    {
        document.write('<div style="left: 0px; width: 100%; position: absolute; top: '+(roll_height_<?=$uni?>*n_<?=$uni?>)+'px" id="scroll_area_<?=$uni?>'+n_<?=$uni?>+'">\n'+roll_text_<?=$uni?>[idx_<?=$uni?>]+'\n</div>\n');
    }

    <?
    unset($roll_text);
    for ($i=0; $i<count($list); $i++) {
        $href = "<a href='./?doc=$cart_dir/item.php&it_id=$row[it_id]' class=item>";

        $k = (int)($i / $line_mod);
$list[$i][gr_subject] =addslashes($list[$i][gr_subject]);
$list[$i][bo_subject] =addslashes($list[$i][bo_subject]);
$list[$i][wr_subject] =addslashes($list[$i][wr_subject]);

        $roll_text[$k] .= "<div style=\"height:{$height}px; padding-top:0px;\">";
        //$roll_text[$k] .= "<div style=\"height:{$height}px; padding-top:5px;\">";
        $roll_text[$k] .= "<img src=\"{$latest_skin_path}/img/latest_icon.gif\" align=absmiddle border=0>&nbsp;&nbsp;";
        $roll_text[$k] .= "<a href=\"{$list[$i][href]}\">";
        $roll_text[$k] .= "[";
        $roll_text[$k] .= $list[$i][gr_subject];
        $roll_text[$k] .= "/";
        $roll_text[$k] .= $list[$i][bo_subject];
        $roll_text[$k] .= "] ";
        $roll_text[$k] .= $list[$i][wr_subject];
        //$roll_text[$k] .= "[";
        //$roll_text[$k] .= $list[$i][gr_subject];
        //$roll_text[$k] .= "] ";
        //$roll_text[$k] .= $list[$i][wr_subject];
        if ($list[$i][comment_cnt])
            $roll_text[$k] .= " {$list[$i][comment_cnt]}";
        $roll_text[$k] .= "</a>";
        $roll_text[$k] .= "</div>";
    }

    for ($i=0; $i<=$k; $i++) {
        echo "roll_text_{$uni}[$i] = '{$roll_text[$i]}';\n";
    }
    ?>
    </script>

    <div style="left: 0px; width: 100%; position: relative; top: 0px; height: <?=$box_height?>px; overflow:hidden;" onMouseover="bMouseOver_<?=$uni?>=0" onMouseout="bMouseOver_<?=$uni?>=1" id="latest_scroll_<?=$uni?>">
    <script language='javascript'>
    var no_script_flag_<?=$uni?> = false ;
    if ( navigator.appName == "Microsoft Internet Explorer" ) {
        if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 ) {
            document.write ( roll_text_<?=$uni?>[0] ) ;
            no_script_flag_<?=$uni?> = true ;
        }
    }
    if ( no_script_flag_<?=$uni?> == false )
        start_roll_<?=$uni?>();
    </script>
    </div>  

<? } ?>

                </nobr></td></tr></table></td></tr>
<tr><td colspan=2 height=10></td></tr>
</table></td>
</tr></table>
추천1

댓글목록

profile_image

헐랭이님의 댓글

헐랭이쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 작성일

위의 방법은 스킨에서 수정한 방법이며 extend/new_scroll_latest.lib.php 에서
위소스를 참고하여 수정하셔도 되겠네요.

profile_image
profile_image

테러보이스님의 댓글

테러보이스쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 작성일

헐랭이님여기 왠일이신지.?

profile_image

제로님의 댓글의 댓글

제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일

회원이시니까요!~^^

profile_image
profile_image

clones님의 댓글

clones쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일

짱이네요. 감사합니다. ^^

Total 90건 6 페이지
  • RSS
제나플러스 목록
번호 제목 글쓴이 조회 추천 날짜
15 연후아빠쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 7394 1 05-15
14 연후아빠쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 10408 1 03-25
13 연후아빠쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 9306 1 03-08
12 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10609 1 02-07
11 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 11536 1 01-25
10 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8404 1 01-24
9 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9395 1 12-30
8 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9949 1 11-29
7 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7476 1 09-07
6 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7499 1 07-02
5 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7908 1 06-17
4 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8069 1 06-17
열람중 헐랭이쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 10036 1 06-14
2 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9059 1 06-13
1 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 14155 3 05-25

검색

회원로그인

회원가입

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒140-0011 東京都品川区東大井2-5-9-203
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

접속자집계

오늘
1,774
어제
4,566
최대
6,509
전체
1,066,435
Copyright (c) 株式会社YHPLUS. All rights reserved.