최근게시물 정렬 질문드립니다!!! 정보
최근게시물 정렬 질문드립니다!!!본문
// By Cysn 2009-06-18 최근게시물에 2개이상의 게시판 을 최근순서대로 불러올때..
function latest2($skin_dir="", $bo_table1,$bo_table2,$bo_table3,$bo_table4,$bo_table5,$bo_table6, $rows=10, $subject_len=40, $options="")
//$bo_table1,$bo_table2,$bo_table3,$bo_table4, 는 몇개 불러올지.. 맘대로 늘리시면 됩니다.
{
global $g4;
$time = time();
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4', '$bo_table5', '$bo_table6') ";
// '$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4' 역시 몇개 불러올건지.. 위에 맞게 수정하시면 되겠습니다.
$sql_common .= " and a.wr_id = a.wr_parent and unix_timestamp(a.bn_datetime) + 86400 * 2 > $time ";
// 요건 원본글만 불러온다는 말이죠..
$sql_order = " order by a.bn_id desc ";
// 요건 new테이블에 저장된 최근 순서대로..
// 이 부분을 각 게시판에 wr_hit로 정렬하고 싶은데 값을 가져오기 힘드네요
$sql_select = " b.gr_id, a.bo_table, a.wr_id, a.wr_parent, a.bn_datetime, b.bo_subject ";
$list = array();
$sql = " select $sql_select, b.bo_subject
$sql_common
$sql_order
limit $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$list[$i] = get_list($row2, $board, $latest_skin_path, $subject_len);
$bo_herf[$i] = $row[bo_table];
$bo_name[$i] = $row[bo_subject];
$list[$i][wr_date] = $row2[wr_datetime];
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
$sql_order = " order by a.bn_id desc ";
이 부분을 각 게시판에 wr_hit로 정렬하고 싶은데 값을 가져오기 힘드네요
도와주세요
function latest2($skin_dir="", $bo_table1,$bo_table2,$bo_table3,$bo_table4,$bo_table5,$bo_table6, $rows=10, $subject_len=40, $options="")
//$bo_table1,$bo_table2,$bo_table3,$bo_table4, 는 몇개 불러올지.. 맘대로 늘리시면 됩니다.
{
global $g4;
$time = time();
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4', '$bo_table5', '$bo_table6') ";
// '$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4' 역시 몇개 불러올건지.. 위에 맞게 수정하시면 되겠습니다.
$sql_common .= " and a.wr_id = a.wr_parent and unix_timestamp(a.bn_datetime) + 86400 * 2 > $time ";
// 요건 원본글만 불러온다는 말이죠..
$sql_order = " order by a.bn_id desc ";
// 요건 new테이블에 저장된 최근 순서대로..
// 이 부분을 각 게시판에 wr_hit로 정렬하고 싶은데 값을 가져오기 힘드네요
$sql_select = " b.gr_id, a.bo_table, a.wr_id, a.wr_parent, a.bn_datetime, b.bo_subject ";
$list = array();
$sql = " select $sql_select, b.bo_subject
$sql_common
$sql_order
limit $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$list[$i] = get_list($row2, $board, $latest_skin_path, $subject_len);
$bo_herf[$i] = $row[bo_table];
$bo_name[$i] = $row[bo_subject];
$list[$i][wr_date] = $row2[wr_datetime];
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
$sql_order = " order by a.bn_id desc ";
이 부분을 각 게시판에 wr_hit로 정렬하고 싶은데 값을 가져오기 힘드네요
도와주세요
댓글 전체
새로등록된글 테이블에서 원하는게시판글 최근꺼 불러와서리...
게시판 하나에서 최신글 불러오려면 갠찮은데
두개이상에서는 히트순으로 불러오기 조금 힘들듯하네요...
게시판 하나에서 최신글 불러오려면 갠찮은데
두개이상에서는 히트순으로 불러오기 조금 힘들듯하네요...