주간 인기글을 뽑아오는 메인최신글추출소스 > 그누4 질문답변

그누4 질문답변

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

주간 인기글을 뽑아오는 메인최신글추출소스 정보

주간 인기글을 뽑아오는 메인최신글추출소스

본문

안녕하세요 아래 소스는 링크로 적은 스킨중에 주간 소스입니다.
혹시 아래 소스에 그룹명이 아닌 내가 원하는 게시판만 다중으로 주간 인기글로 추출할수는 없나요?
그리고 날림으로 수정하다보니.....
원래 1번과 2번~10번까지가 출력되는게 다른데 그냥 1~10번까지 동일하게 출력하게 깔끔하게 수정도 가능한지요?
부탁드립니다 (__);;;
 

<?
include_once("./_common.php");

define("_CO_INDEX_", TRUE);

$html_title = "thecoupe";
$g4[title] = "" . $html_title;
include_once("./_head.php");

$before_day = 7; //게시물을 추출할기간설정
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));

$list1 = array();

$top1 = 5;
$gr_id_new = "thecoupe";  //그룹아이디
$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],22,'…');
        $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],22,'…');
        $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="595" border="0" cellspacing="0" cellpadding="0">
<tr>
        <?
        $i=0;
        foreach($list2 as $key=>$value) {
            if ($i++>=($top1)) break;
        ?>
            <td style='word-break:break-all;'>
                <?
//이미지 찾아오기 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]

if($i==1){
$image_check = @getimagesize($list2[$key][bf_file]); //이미지 유무판단을 위한 임시사용
if($image_check[0]){
$l_sub = cut_str(get_text($list2[$key][subject]), 24);
echo "<table width=116 cellpadding=0 cellspacing=0 border=0>
<tr><td align=left valign=top width=116 height=120><a href='{$list2[$key][href]}'><img src='{$list2[$key][bf_file]}' border=0 width=108 height=108 class=img1></a></td></tr>
<tr><td><a href='{$list2[$key][href]}'>{$l_sub}</a></td></tr></table>";
} else {
echo "<table width=116 cellpadding=0 cellspacing=0 border=0>
<tr><td align=left valign=top width=116 height=120><a href='{$list2[$key][href]}'><img src='$g4[path]/img/bbs-noimg.gif' border=0 width=108 height=108 class=img1></a></td></tr>
<tr><td><a href='{$list2[$key][href]}'>{$l_sub}</a></td></tr></table>"; //이미지가 아닌경우 또는 이미지가 없는경우
}
} else {
$image_check = @getimagesize($list2[$key][bf_file]); //이미지 유무판단을 위한 임시사용
if($image_check[0]){
echo "<table width=116 cellpadding=0 cellspacing=0 border=0>
<tr><td align=left valign=top width=116 height=120><a href='{$list2[$key][href]}'><img src='{$list2[$key][bf_file]}' border=0 width=108 height=108 class=img1></a></td></tr>
<tr><td><a href='{$list2[$key][href]}'>{$list2[$key][subject]}</a></td></tr></table>";
} else {
echo "<table width=116 cellpadding=0 cellspacing=0 border=0>
<tr><td align=left valign=top width=116 height=120><a href='{$list2[$key][href]}'><img src='$g4[path]/img/bbs-noimg.gif' border=0 width=108 height=108 class=img1></a></td></tr>
<tr><td><a href='{$list2[$key][href]}'>{$list2[$key][subject]}</a></td></tr></table>"; //이미지가 아닌경우 또는 이미지가 없는경우
}}
                ?>
            </td>
        <? } ?>

        <? if (count($list2) == 0) { ?>
<td colspan=1 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td>
        <? } ?>
</tr>
        </table>

댓글 전체

원하는 게시판만 불러오시려면,

$gr_id_new = "thecoupe";  //그룹아이디
$sql = " select bo_table, bo_notice from $g4[board_table]
          where gr_id = '$gr_id_new'
            and bo_use_search = 1 ";

부분을

//$gr_id_new = "thecoupe";  //그룹아이디
$bo_tables = "('board1','board2','board3')";    // <-- board1~3은 원하는 게시판의 bo_table 값들
$sql = " select bo_table, bo_notice from $g4[board_table]
          where bo_table in $bo_tables";

로 바꾸시면 될듯..

----
1번, 2~10번 출력부분은..
코드만 봐서는, 원래 스킨에서 보여지는 1번만 이미지가 같이 나오는 형태가 아닌것 같은데요?
수정하신듯..
지금은 두 경우가 글제목 자르는 것 빼고 동일하네요.
(쪽지까지 주시고 ^^; 괜찮습니다. ^^)
저런.. 음.. 변화가 없는 부분이, 어느부분이죠?
선택된 게시판만 나오는 부분이 차이가 없나요?
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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