최신글 중복 관련 문의 드립니다 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

최신글 중복 관련 문의 드립니다 정보

최신글 중복 관련 문의 드립니다

본문

메인 페이지에.. 여러가지의 최신글이 들어가는데...

3가지의 종류를 탭으로 구성하려고 합니다...

전체베스트/ 게시판1 베스트/ 그룹1 베스트  이렇게 구성하려고 하는데요...

같은 스킨이 중복 되니까 하나만 열리고 나머지는 열리지 않네요..

function 부분을 다른 이름으로 고쳐 봤는데... 안되네요 ㅜㅜ

소스는 예전에 받아논 것인데 어느 분껀지 기억이 잘 나지 않네요...
 freeimage.kr 김성대 2009-11-29  분껄로... 이용중입니다

부디 명쾌한 해설 부탁드립니다 ㅜㅜ

소스 ----------------------------------------------------------------

<?
//전체게시판 또는 지정된 그룹에서 추천수,조회수,코멘트가 일정이상인 게시판중 베스트를 추려 출력한다.
//게시판명과는 관계가 없으므로 가능한 작은수의 게시판을 지정한다.
//작성 : freeimage.kr 김성대 2009-11-29
//사용 방법
//1. latest.skin.php 의 상단부분에서 추천수,조회수 등을 지정한다.
include_once("$g4[path]/lib/latest.lib.php");

$추천수=0;
$조회수=50;
$코멘트=1;
$검색일=30;
if (!$rows) $rows=10;
if (!$subject_len) $subject_len=40;
$gr_id_지정=""; //특정 그룹을 지정할경우 공백으로 구별하여 나열
$gr_id_제외="gnu bujok adm help tax"; //특정 그룹을 제외할경우 공백으로 구별하여 나열
$bo_table_지정=""; //특정 게시판을 지정할경우 공백으로 구별하여 나열
$bo_table_제외=""; //특정 게시판을 제외할경우 공백으로 구별하여 나열

//1 가능한 게시판 읽기
if (!function_exists("parse_arr1")) {
function parse_arr1($str) {
$str=trim($str);
if (!$str||count($str)<1) return "";
$out="";
$arr=explode(" ",$str);
foreach($arr as $code) {
if ($out) $out.=",";
$out.="'$code'";
}
if ($out) return "($out) ";
return "";
}
}
$arr_board = array();
$bo_list_level=intval($member[mb_level]);if ($bo_list_level<=1) $bo_list_level=1;
$sql = "select * from $g4[board_table] where bo_list_level<=$bo_list_level and bo_use_search = '1' ";


if ($gr_id_지정) $sql.="and gr_id in ".parse_arr1($gr_id_지정);
if ($gr_id_제외) $sql.="and gr_id not in ".parse_arr1($gr_id_제외);

if ($bo_table_지정) $sql.="and bo_table in ".parse_arr1($bo_table_지정);
if ($bo_table_제외) $sql.="and bo_table not in ".parse_arr1($bo_table_제외);

$result = sql_query($sql);
$board_list="";
for ($i=0; $row=sql_fetch_array($result); $i++)
{
//var_dump($row);
$arr_board["{$row[bo_table]}"]=$row[bo_subject2]?$row[bo_subject2]:$row[bo_subject];
if ($board_list) $board_list.=",";
$board_list.="'$row[bo_table]'";
}
//secho $sql,$board_list;

// 2 해당되는 모든 글 가져오기
$sql_common = "from $g4[board_new_table] where 1 ";
if ($_GET[bo_table]) $sql_common.= "and bo_table='$_GET[bo_table]' ";
else $sql_common.= "and bo_table in ($board_list) ";
$sql_common.= "and wr_id = wr_parent "; //원글만 검색
//$sql_common .= "and a.wr_id <> a.wr_parent "; //코멘트만 검색하려면 이것
//if ($gr_id) $sql_common .= " and b.gr_id = '$gr_id' ";
$sql_common .= "and bn_datetime >= '".date("Y-m-d H:i:s",time()-$검색일*24*3600)."' "; //최근 30일기준
$sql_order = " order by bn_id desc ";
$sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id'  ";
//$sql_order = " order by a.bn_datetime desc ";


$list = array();
$sql = " select *
          $sql_common
  $sql_order
 
          limit 10000 "; //10000개까지 너무 많으면 메모리 속도 문제됨
$result = sql_query($sql);
//echo "$sql<BR>";
$i=0;
while($row=sql_fetch_array($result))
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
if ($row2[wr_good]>=$추천수 or $row2[wr_hit]>=$조회수 or $row2[wr_comment]>=$코멘트) {  //추천 5개 이상 또는 조회 50건 이상 또는 코멘트 2개이상
$row2[bo_table]=$row[bo_table];
$row2[bo_subject]=$row[bo_subject];
$list[$i] = $row2;

$i++;

}
}

# 인기글
//점수 조건 hit+댓글*30+(추천-반대)*300
function usort_best1($a, $b)
{
return $b['wr_hit']+$b['wr_comment']*30+($b[wr_good]-$b[wr_nogood])*300 - ($a['wr_hit']+$a['wr_comment']*30+($a[wr_good]-$a[wr_nogood])*300);
}

usort($list, 'usort_best1');

?>

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">


<style>
.list_comment3 {color:#404040;background-color:#f0f0f0;font-size:8pt;font-family:tahoma;font-weight:bold}
</style>



<tr>
<td colspan="2" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr height="6"><td></td></tr>
<tr>
<td valign=top>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><?=$img?></td>
<td align="center" valign="top" width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<? for ($i=0; $i<min($rows,count($list)); $i++) { ?>
<tr height="23">
<td><b>&nbsp;<img src="<?=$latest_skin_path?>/img/<?=($i+1)?>.gif" border="0" align=absmiddle></b>
<?
//날짜표시
$date = explode("-", $date1);
$year = $date[0];
$month = $date[1];
$day = $date[2];
$latest_date = $year."-".$month."-".$day."";
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
echo "<strong>{$list[$i]['subject']}</strong>";
else ?>
                           
<?=cut_str($list[$i][wr_subject],$subject_len)?><?=$list[$i][wr_id]?>&&<?=$list[$i][bo_subject]?><?=$bo_subject?><?=$arr_board["{$list[$i][bo_table]}"]?>[<?=$list[$i][bo_table]?>]
                                <? if ($list[$i][wr_comment]) echo "<sup><span class=list_comment3> {$list[$i][wr_comment]} </span></sup>"; ?>
<? //="H:{$list[$i][wr_hit]} Cmt: {$list[$i][wr_comment]} 추천: {$list[$i][wr_good]} 반대: {$list[$i][wr_nogood]} "?>
                                <?
echo "</a>";

if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\" style='font-size:9px; color:#EE5A00; vertical-align:1px;'>{$list[$i]['comment_cnt']}</a>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_hot'];
//echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
//echo " " . $list[$i]['icon_secret'];
echo "</td><td width=36 align=right>";
echo "<font color=#bababa class=small>{$list[$i][datetime2]}</font>&nbsp;</td>";
?></td></tr><? } ?>

</table>

</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>

<? if (count($list) == 0) { ?><tr><td align=center width="100%"><font color=#6A6A6A>현재 등록된 글이 없습니다.</a></td></tr><? } ?>
</table>

댓글 전체

전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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