게시판 그룹 조회수별 순위 질문이요 정보
게시판 그룹 조회수별 순위 질문이요본문
첫째 테이블은
그룹 bbs에 테이블 lineage이구요
둘째 테이블은
그룹 bbs2에 테이블 board입니다.
그런데 첫째 그룹을 지정해준 목록은 잘 나오는데
두번째 그룹을 지정해둔 목록은 전체 리스트가 다 나와버립니다.
홈피주스는 http://freerank.hostei.com/ 이구요
인클루드 한 소스는 아래와 같습니다
<?
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
$list1 = array();
if ($before_day == 1){
$imgname = "no_s_";
} else if ($before_day == 7) {
$imgname = "no_";
}
$sql = " select bo_table, bo_notice from $g4[board_table]
where gr_id = '$gr_id_new'
and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql2 = " select * from $g4[write_prefix]$row[bo_table]
where wr_comment > -1
and wr_datetime >= '$before_time' ";
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
{
$key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
$list1[$key][subject] = conv_subject($row2[wr_subject],70,'…');
$list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list1[$key][bo_table] = $row[bo_table];
$list1[$key][wr_id] = $row2[wr_id];
$list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list1[$key][comment] = $row2[wr_comment];
$list1[$key][comment_cnt] = "($row2[wr_comment])";
$key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
$list2[$key][subject] = conv_subject($row2[wr_subject],70,'…');
$list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list2[$key][bo_table] = $row[bo_table];
$list2[$key][wr_id] = $row2[wr_id];
$list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list2[$key][wr_hit] = $row2[wr_hit];
$list2[$key][hit] = "($row2[wr_hit])";
$list2[$key][content] = cut_str(get_text($row2[wr_content]), 80);
$list2[$key][file][0][file] = $row2[file][1][file];
}
}
krsort($list2);
$latest_skin_path = "$g4[path]/skin/latest/rank";
?>
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td>
<b>
<?if ($before_day == 1){
?>일간<?
} else if ($before_day == 7) {
?>주간<?
}
?>
인기글</b>(<?=$gr_id_new?>,<?=$g4[board_table]?>,<?=$g4[write_prefix]?>,<?=$row[bo_table]?>)
</td></tr>
<?
$i=0;
foreach($list2 as $key=>$value) {
if ($i++>=($top1)) break;
?>
<tr>
<td>
<?
//이미지 찾아오기 1
$sql_1 = " select bf_file from `$g4[board_file_table]` where bo_table = '{$list2[$key][bo_table]}' and wr_id = '{$list2[$key][wr_id]}' order by bf_no limit 1 ";
$result_1 = mysql_fetch_array(sql_query($sql_1));
//##### 기본파일경로 또는 썸네일 사용은 둘중 하나만선택하셔서 잡으셔야 합니다.
//기본 파일경로 사용할경우
$data_path = "$g4[path]/data/file/{$list2[$key][bo_table]}/"; //게시판 업로드 기본경로
$list2[$key][bf_file] = $data_path . $result_1[bf_file]; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
$check = $list2[$key][bf_file];
//echo "{$list2[$key][bf_file]}";
//섬네일 사용할경우
//섬네일 생성 구문 추가 필요
//$data_path = "$g4[path]/_thumb/_$gr_id_new/rank_day/"; //섬네임 특정 디렉토리 생성 경로
//$thum = ".Thum";
//$list2[$key][bf_file] = $data_path . $result_1[bf_file] . $thum; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
echo "<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td align=center width=20>";
echo "<img src='".$latest_skin_path."/img/".$imgname.$i.".gif' border=0 align=absmiddle></td><td><a href='{$list2[$key][href]}'>";
if ($list2[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
echo "</a>";
/* if ($list2[$key][hit])
echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>"; //히트수*/
echo "</td></tr></table>";
?>
</td>
</tr>
<? } ?>
<? if (count($list2) == 0) { ?>
<tr><td colspan=1 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
그룹 bbs에 테이블 lineage이구요
둘째 테이블은
그룹 bbs2에 테이블 board입니다.
그런데 첫째 그룹을 지정해준 목록은 잘 나오는데
두번째 그룹을 지정해둔 목록은 전체 리스트가 다 나와버립니다.
홈피주스는 http://freerank.hostei.com/ 이구요
인클루드 한 소스는 아래와 같습니다
<?
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
$list1 = array();
if ($before_day == 1){
$imgname = "no_s_";
} else if ($before_day == 7) {
$imgname = "no_";
}
$sql = " select bo_table, bo_notice from $g4[board_table]
where gr_id = '$gr_id_new'
and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql2 = " select * from $g4[write_prefix]$row[bo_table]
where wr_comment > -1
and wr_datetime >= '$before_time' ";
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
{
$key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
$list1[$key][subject] = conv_subject($row2[wr_subject],70,'…');
$list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list1[$key][bo_table] = $row[bo_table];
$list1[$key][wr_id] = $row2[wr_id];
$list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list1[$key][comment] = $row2[wr_comment];
$list1[$key][comment_cnt] = "($row2[wr_comment])";
$key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
$list2[$key][subject] = conv_subject($row2[wr_subject],70,'…');
$list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list2[$key][bo_table] = $row[bo_table];
$list2[$key][wr_id] = $row2[wr_id];
$list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list2[$key][wr_hit] = $row2[wr_hit];
$list2[$key][hit] = "($row2[wr_hit])";
$list2[$key][content] = cut_str(get_text($row2[wr_content]), 80);
$list2[$key][file][0][file] = $row2[file][1][file];
}
}
krsort($list2);
$latest_skin_path = "$g4[path]/skin/latest/rank";
?>
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td>
<b>
<?if ($before_day == 1){
?>일간<?
} else if ($before_day == 7) {
?>주간<?
}
?>
인기글</b>(<?=$gr_id_new?>,<?=$g4[board_table]?>,<?=$g4[write_prefix]?>,<?=$row[bo_table]?>)
</td></tr>
<?
$i=0;
foreach($list2 as $key=>$value) {
if ($i++>=($top1)) break;
?>
<tr>
<td>
<?
//이미지 찾아오기 1
$sql_1 = " select bf_file from `$g4[board_file_table]` where bo_table = '{$list2[$key][bo_table]}' and wr_id = '{$list2[$key][wr_id]}' order by bf_no limit 1 ";
$result_1 = mysql_fetch_array(sql_query($sql_1));
//##### 기본파일경로 또는 썸네일 사용은 둘중 하나만선택하셔서 잡으셔야 합니다.
//기본 파일경로 사용할경우
$data_path = "$g4[path]/data/file/{$list2[$key][bo_table]}/"; //게시판 업로드 기본경로
$list2[$key][bf_file] = $data_path . $result_1[bf_file]; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
$check = $list2[$key][bf_file];
//echo "{$list2[$key][bf_file]}";
//섬네일 사용할경우
//섬네일 생성 구문 추가 필요
//$data_path = "$g4[path]/_thumb/_$gr_id_new/rank_day/"; //섬네임 특정 디렉토리 생성 경로
//$thum = ".Thum";
//$list2[$key][bf_file] = $data_path . $result_1[bf_file] . $thum; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
echo "<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td align=center width=20>";
echo "<img src='".$latest_skin_path."/img/".$imgname.$i.".gif' border=0 align=absmiddle></td><td><a href='{$list2[$key][href]}'>";
if ($list2[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
echo "</a>";
/* if ($list2[$key][hit])
echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>"; //히트수*/
echo "</td></tr></table>";
?>
</td>
</tr>
<? } ?>
<? if (count($list2) == 0) { ?>
<tr><td colspan=1 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
댓글 전체