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

1년전 BEST10 게시물 축출하기.

** 아래와 같은경우 사용하시면 좋을듯 합니다.**
1. 최신게시물스킨에서 3월 10일 ~ 4월 10일 까지 검색된 내용만 최신글에 노출시킬경우.

2. 사이트운영상 1년전에 히트수가 높은 게시물 BEST 10 만 메인에 출력하고 싶은경우.

즉, 어떤 특정기간동안 히트수 또는 주천수가 많은 게시물을 메인에 노출할 경우 사용.

-----------------------------------------------------

<?

// ucc 축출
function latest_ucc($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="",$options2="",$s_subject="",$s_turn="",$t_end="")
{
    global $g4;

    if ($skin_dir)
        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
    else
        $latest_skin_path = "$g4[path]/skin/latest/basic";

//정렬값이 없다면
if(!$options2)
$options2 = "wr_id";


    //가로정렬값이 없는경우
if(!$options)
$options = 3;

//$bo_table 초기화,  이부분은 특정게시판을 사용하기 위함, 삭제하세요.
$bo_table = "";
$bo_table = "product";


    $list = array();

    $sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
    $board = sql_fetch($sql);

    $tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름

    //기간별 조건검색이 없는경우
if(!$s_turn){
    $s_turn  = 365;  // 조건값이 없을경우 1년 이내의 자료만 검색
}

$s_day    = 24;
$s_time  = $s_day*$s_turn; //정수값을 1일로 환산처리.
    $now_time = $g4[time_ymdhis];  //현재시간기준,  삭제해도 됨.
    $s_start  = date("Y-m-d H:i:s", time()-3600 * $s_time);

    //기간별 조건검색이 없는경우
if(!$t_end){
    $t_end  = $g4[time_ymdhis];;  // 현재시간
}
else{

$t_day    = 24;
$t_time  = $s_day*$t_end; //정수값을 1일로 환산처리.
    $now_time = $g4[time_ymdhis];  //현재시간기준,  삭제해도 됨.
    $t_end  = date("Y-m-d H:i:s", time()-3600 * $t_time);
}
   
//조건
$s_mct  =  "wr_is_comment = 0 ";
$s_mct .=  " and wr_datetime >= '$s_start'";
$s_mct .=  " and wr_datetime <= '$t_end'";

    $sql = " select * from $tmp_write_table where $s_mct order by $options2 desc limit 0, $rows ";
    //explain($sql);
    $result = sql_query($sql);
    for ($i=0; $row = sql_fetch_array($result); $i++)
        $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
   
    ob_start();
    include "$latest_skin_path/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}


?>
= '$s_start'"; $s_mct .= " and wr_datetime <= '$t_end'"; $sql = " select * from $tmp_write_table where $s_mct order by $options2 desc limit 0, $rows "; //explain($sql); $result = sql_query($sql); for ($i=0; $row = sql_fetch_array($result); $i++) $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len); ob_start(); include "$latest_skin_path/latest.skin.php"; $content = ob_get_contents(); ob_end_clean(); return $content; } ?>

댓글 작성

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

로그인하기

댓글 2개

ㅎㅎ... 수고 많으세요
감사합니다..ㅎㅎㅎ 저도 잘 이용해 보면 좋겠어요..;ㅁ;

게시판 목록

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
글쓰기
🐛 버그신고