최근게시물을 다운로드 순서로 정렬할 수 있나요? 정보
최근게시물을 다운로드 순서로 정렬할 수 있나요?본문
최근게시물을 다운로드 순서로 정렬할 수 있나요?
즉 다운로드가 많은 게시물의 리스트를 뽑았으면 합니다.
댓글 전체
latest.lib.php파일에 아래 내용 추가해서 적용해보세요
function latest_download($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$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; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table a, $g4[board_file_table] b where a.wr_id =b.wr_id and b.bf_no=0 and b.bo_table= '$bo_table' and a.wr_is_comment = 0 order by b.bf_download 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;
}
function latest_download($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$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; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table a, $g4[board_file_table] b where a.wr_id =b.wr_id and b.bf_no=0 and b.bo_table= '$bo_table' and a.wr_is_comment = 0 order by b.bf_download 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;
}