구매고객
판매자
솔루션별 질문
객관적이지 않은 사유는 인정되지 않으며, 신고 권한이 제재될 수 있습니다.
0/200
신고 사유에 해당하지 않는 글을 신고하면 신고 권한이 제한될 수 있습니다.
이 회원의 커뮤니티 콘텐츠와 알림을 내 화면에서만 숨깁니다.
신고는 접수되지 않으며, 숨긴 회원은 내 정보에서 다시 보이게 할 수 있습니다.
신고할 글이 아닌가요? 이 회원만 숨기기
신고하기로 돌아가기
그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.
전체 67032개 중 53321-53340번째
댓글 2개
적용사례: http://bitnuri.tv/index.php?gr_id=gr_best 기간별 설정에 위한 게시물 출력.
아래는 전체 소스입니다.
------------------------------------------
<?
// 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;
}
?>
==>> 최신 게시물의 기간조정을 하려면... " 시작일 ~ 최근일 " 을 축출할려면...결국 latest skin함수를 변형해야 합니다.
가령 위의 내용을 서술하면. 30일 부터 5일까지의 wr_hit 순으로 출력할경우 사용하시면 될듯 하구요. 해당 스킨은 그대로 최근게시물과 동일합니다. 즉, 결과물을 조건식으로 처리하시면 됩니다.
응용방법: 1개월전의 최근베스트 게시물 10개 축출, 지난 과거 뉴스 출력 등...
위 함수를 이용하시면 순위 사이트로도 확대가 가능합니다.
적용사례: http://fashionlist.co.kr/index.php?gr_id=top_num