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

최신글 여러 게시판 다중 적용하기

· 14년 전 · 4199 · 1
말그대로 freeboard란 게시판과 qna라는 게시판을 하나의 최신글 스킨으로 쓰고 싶을때

latest(스킨, freeboard|qna, 10, 50, '')

이런식으로 넣으면 두 게시판의 글을 최신순으로 그냥 쭉 뽑아 오게 하는건데요.. 다른 게시판도 추가 하고 싶으면

latest(스킨, freeboard|qna|notice|buysell, 10, 50, '')

이런식으로 추가 하면 되구요..
제로보드에선 관련 팁이 많았는데, 그누보드도 분명히 있을거 같은데 찾기가 힘드네요.

그룹으로 모으는건 아니구요.. 지금 그룹으로 모아서 표시하는건 사용 중인데, 그룹이 다른 여러 게시판을 한꺼번에 표시할 일도 있어서요. 지금, 일반 최신글, 그룹별 최신글, 전체 최신글 3개 쓰고 있는데.. 그냥 제가 말한게 구현만 된다면 굳이 3개를 쓸 필요가 없네요..

수정 하려니까 소스도 많이 복잡해서 어디부터 건들여야 될 지 모르겠습니다. 혹시 관련 팁이 이미 나와 있다면 알려 주시고, 아니면 그냥 대략적인 구현 방법이라도 설명 해 주시면 감사하겠습니다. 어딜 대충 어떻게 수정 하라던가..

댓글 작성

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

로그인하기

댓글 1개

latest.lib.php 에 추가

// 최신글 추출 (다중 테이블)
function latest_multi($skin_dir="", $bo_table1,$bo_table2,$bo_table3,$bo_table4, $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_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')
and a.wr_id = a.wr_parent
order by a.bn_id desc
limit $rows ";

$result = sql_query($sql);

for ($i=0; $board=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $board[bo_table];

$sql = "select * from $tmp_write_table where wr_id = '$board[wr_id]'";
$result2 = sql_query($sql);
$row2 = sql_fetch_array($result2);

$list[$i] = get_list($row2, $board, $latest_skin_path, $subject_len);
$list[$i][bo_table] = $board[bo_table];
}

ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();

return $content;
}

게시글 목록

번호 제목
284438
284437
284435
284430
284420
284417
284409
284401
284399
284397
284380
284378
284371
284370
284366
284364
284360
284357
284355
284354