테스트 사이트 - 개발 중인 베타 버전입니다

실시간 인기검색어 캐시 시간 조절 하는방법좀..

· 13년 전 · 1533
간지의제왕 님이 올리신 스킨쓰는데요

http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=84740&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%EC%9D%B8%EA%B8%B0%EA%B2%80%EC%83%89%EC%96%B4&sop=and

캐시가 안되고 바로 실시간 으로 뜨는데, 캐시시간 조절은 어디서 해야하나요?


아래는 소스입니다.

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

$pop_all_width = 180; // 전체 가로 크기
$pop_line_height = 22; //검색어 한줄당 세로 크기
$date_gap_old = date("Y-m-d", strtotime($date_gap) - ($date_cnt * 86400));

$old = array();
$sql2 = " select pp_word, count(*) as cnt from $g4[popular_table]
where pp_date between '$date_gap_old' and '$date_gap'
group by pp_word
order by cnt desc, pp_word
limit 0, 100 ";
$qry2 = sql_query($sql2);
$count = mysql_num_rows($qry2);
for ($j=0; $row2=sql_fetch_array($qry2); $j++) {
$old[$j] = $row2;
}

for ($i=0; $i<$pop_cnt; $i++)
{
for ($j=0; $j<$count; $j++) {
if ($old[$j][pp_word] == $list[$i][pp_word]) {
break;
}
}

$list[$i][pp_word] = urldecode($list[$i][pp_word]);
$list[$i][pp_rank] = $i + 1;
if ($count == $j) {
$list[$i][old_pp_rank] = 0;
$list[$i][rank_gap] = 0;
} else {
$list[$i][old_pp_rank] = $j + 1;
$list[$i][rank_gap] = $list[$i][old_pp_rank] - $list[$i][pp_rank];
}
if ($list[$i][rank_gap] > 0)
$list[$i][icon] = "up";
else if ($list[$i][rank_gap] < 0)
$list[$i][icon] = "down";
else if ($list[$i][old_pp_rank] == 0)
$list[$i][icon] = "new";
else if ($list[$i][rank_gap] == 0)
$list[$i][icon] = "nogap";
}
?>
<link rel="stylesheet" type="text/css" href="<?=$popular_skin_path?>/style.css" />
<table id="popular" style="border:1px solid #dddddd" border="0" width="180px" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class='subject'>실시간 인기 검색어</div>

<table height="<?=$pop_line_height*$pop_cnt?>" width='<?=$pop_all_width-20?>' cellpadding='0' cellspacing='0' border='0' align='center'>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td height="<?=$pop_line_height?>" valign="top">
<div style="width:180px; height:<?=$pop_line_height?>; position:absolute; overflow:hidden;">
<table id="tdpop<?=$i?>" class='noover_li' height="<?=$pop_line_height?>" width='<?=$pop_all_width-20?>' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td width="<?=$pop_all_width-25?>" class="word t<?=sprintf("%02d", $i+1)?>"><a href="<?=$g4[bbs_path]?>/search.php?sfl=wr_subject&sop=and&stx=<?=urlencode($list[$i][pp_word])?>"><?=$list[$i][pp_word]?></a></td>
<td width='25' class='gap'>
<? switch ($list[$i][icon]) {
case "up" : echo "<img src='{$popular_skin_path}/img/up.gif' alt='Up' hspace='5' align='absmiddle' />".abs($list[$i][rank_gap]).""; break;
case "down" : echo "<img src='{$popular_skin_path}/img/down.gif' alt='Down' hspace='5' align='absmiddle' />".abs($list[$i][rank_gap]).""; break;
case "new" : echo "<img src='{$popular_skin_path}/img/new.gif' alt='New' hspace='5' align='absmiddle' />"; break;
case "nogap" : echo "<img src='{$popular_skin_path}/img/nogap.gif' alt='Nogap' hspace='5' align='absmiddle' />"; break; } ?>
</td>
</tr>
</table>
</div>
</td>
</tr>
<? } ?>
</table>
</td>
</tr>
</table>
<script language='javascript'>
var pop_cnt = parseInt("<?=$pop_cnt?>");
var now_height = parseInt(-<?=$pop_line_height?>);
var now_list = 0;
var pop_skin = "<?=$popular_skin_path?>";
var date_gap = "<?=$date_gap?>";
var date_cnt = "<?=$date_cnt?>";

function go_time () {
time = setInterval("move_bar()", 50);
}

function move_bar () {

now_height++;
for(i=0;i<pop_cnt;i++)
document.getElementById("tdpop" + i).className = 'noover_li';
document.getElementById("tdpop" + now_list).className = 'over_li';

if (now_height == 0) {
now_height = parseInt(-<?=$pop_line_height?>);
now_list++;
}

if (now_list == pop_cnt) {
clearInterval(time);
now_list = 0;
now_height = parseInt(-<?=$pop_line_height?>);
setTimeout("go_time()", 3000);
}
}

setTimeout("go_time()", 2000);
</script>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
284508
284499
284492
284490
284484
284481
284478
284476
284474
284472
284470
284458
284457
284454
284453
284447
284446
284444
284441
284440