검색어 순위 출력 기간 조정에 관하여
본문
최근 검색어 순위 스킨을 쓰고 있는데요. 약 일주일이 지나면 첨부한 이미지처럼
검색어가 공백으로 나타납니다. 기간 설정은 어떻게 하는지 모르겠네요. 아래 관련 스킨입니다.
$date_cnt * 172800 <-이것이 기간을 조정하는 것인가 해서 두배로 했거등요. 그런데도 소용 없습니다.
원래는 $date_cnt * 86400인걸 두배로 했습니다만,,,,
어디를 조정해야 하는지요...고수님 부탁드립니다.ㅜㅜ
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$date_gap_old = date("Y-m-d", strtotime($date_gap) - ($date_cnt * 172800));
$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";
}
?>
<style type="text/css">
.mw-popular { border:1px solid #b9c695; text-align:center; }
.mw-popular td { font-size:13px; line-height:16px; }
.mw-popular a:link { color:#666; text-decoration:none; }
.mw-popular a:active { color:#666; text-decoration:none; }
.mw-popular a:visited { color:#666; text-decoration:none; }
.mw-popular a:hover { color:#ea6f0b; text-decoration:underline; }
.mw-popular .subject { background:url(<?=$popular_skin_path?>/img/t_bg.jpg) repeat-x bottom; height:23px; margin-bottom:6px; padding:0;}
.mw-popular .subject { font-size:13px; color:#000; font-weight:bold; text-decoration:none; text-align:left; }
.mw-popular .subject div { margin:0 0 0 10px;padding:5px 0;}
.mw-popular table { margin:0 0 0 5px;}
.mw-popular .word { height:16px; overflow:hidden; margin:2px 0 0 5px;}
.mw-popular .gap { letter-spacing:-1px; font-size:11px; }
</style>
<div class="mw-popular">
<div class="subject"><div>최근 검색어 순위</div></div>
<table border=0 cellpadding=0 cellspacing=0>
<? for ($i=0; $i<$pop_cnt; $i++) { ?>
<? if (!is_array($list[$i])) continue; ?>
<tr>
<td width="14" height="20"><img src="<?=$popular_skin_path?>/img/<?=sprintf("%02d", $i+1)?>.gif"></td>
<td width="135" align="left">
<div class="word"><a href="<?=$g4[bbs_path]?>/search.php?sfl=&sfl=wr_subject%7C%7Cwr_content&sop=and&stx=<?=urlencode($list[$i][pp_word])?>"><?=$list[$i][pp_word]?></a>
</div>
</td>
<td width="24">
<img src="<?=$popular_skin_path?>/img/<?=$list[$i][icon]?>.gif" align=absmiddle>
<span class="gap"><? if ($list[$i][icon] != "new" && $list[$i][icon] != "nogap") { echo abs($list[$i][rank_gap]); }?></span>
</td>
</tr>
<? } ?>
</table>
</div>
답변 2
제가 소스파악을 못하는건지.... 위의 쿼리문은 카운트만 뽑아오는거 아닌가요??? pp_word검색만하고 쓰는데는 없는거같은데요...
pp_date사이에있는 것들중 pp_word를 그룹바이 기준으로 뽑고나서 나온 pp_word와 갯수를 세기만하지 $list[$i]에 들어가는 글들의 갯수가 안보이네요...
그렇다고 sql2에 있는 쿼리문이 최근검색어순위 리스트를 뽑아주는데 사용되는것도 아니고요...
$date_gap이 제대로 설정되어 있는지 확인해 보세요