여러 게시판에서 최근게시물을 뽑기.
/lib/latest.lib.php 아래에 삽입.
function latest2($skin_dir = "", Array $bo_tableIds, $rows = 10, $subject_len = 40) {
global $g4;
if (!$skin_dir) $skin_dir = 'basic';
if (G4_IS_MOBILE) {
$latest_skin_path = G4_MOBILE_PATH . '/' . G4_SKIN_DIR . '/latest/' . $skin_dir;
$latest_skin_url = G4_MOBILE_URL . '/' . G4_SKIN_DIR . '/latest/' . $skin_dir;
} else {
$latest_skin_path = G4_SKIN_PATH . '/latest/' . $skin_dir;
$latest_skin_url = G4_SKIN_URL . '/latest/' . $skin_dir;
}
$sql_select = " ";
$list = array();
$sql = "
select b.gr_id, a.bo_table, a.wr_id, a.wr_parent, a.bn_datetime, b.bo_subject, b.bo_subject
from $g4[board_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table and a.bo_table in('" . implode("','", $bo_tableIds) . "') and a.wr_id = a.wr_parent
order by a.bn_id desc limit $rows
";
$_boardInfo = array();
$_notExistsBoards = array();
$result = sql_query($sql);
foreach ($bo_tableIds as $tableId) {
$board = sql_fetch("select * from {$g4['board_table']} where bo_table = '" . addslashes($tableId) . "'");
if ($board === false) $_notExistsBoards[] = $tableId;
$_boardInfo[$board['gr_id']] = $board;
}
for ($i = 0; $row = sql_fetch_array($result); $i++) {
$tmp_write_table = $g4['write_prefix'] . $row['bo_table'];
$row2 = sql_fetch("select * from $tmp_write_table where wr_id = '$row[wr_id]'");
$list[$i] = $row2;
$list[$i] = get_list($row2, $_boardInfo[$row['gr_id']], $latest_skin_path, $subject_len);
$bo_href[$i] = $row['bo_table'];
$bo_name[$i] = $row['bo_subject'];
$list[$i]['wr_date'] = $row2['wr_datetime'];
}
ob_start();
if ($_notExistsBoards) {
echo join(", ", $_notExistsBoards) . " 게시판이 존재하지 않습니다.";
}
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
Usage
echo latest2("basic", array("notice","free"), 5, 70);
댓글 4개
takumi22
12년 전
잘사용하겠습니다
9년 전
모든최근게시물 우와 감사합니다 잘 사용하겠습니다 !!!!!
simina
7년 전
잘쓰겠습니다
6년 전
감사합니다~
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4402 | ||
| 2664 |
선택과집중
|
4개월 전 | 571 | |
| 2663 |
|
4개월 전 | 619 | |
| 2662 |
|
4개월 전 | 574 | |
| 2661 |
선택과집중
|
4개월 전 | 508 | |
| 2660 | 4개월 전 | 588 | ||
| 2659 |
Modify
|
4개월 전 | 653 | |
| 2658 |
선택과집중
|
4개월 전 | 415 | |
| 2657 | 4개월 전 | 452 | ||
| 2656 |
|
4개월 전 | 964 | |
| 2655 |
선택과집중
|
4개월 전 | 548 | |
| 2654 | 5개월 전 | 403 | ||
| 2653 |
선택과집중
|
5개월 전 | 585 | |
| 2652 | 5개월 전 | 394 | ||
| 2651 | 5개월 전 | 446 | ||
| 2650 |
선택과집중
|
5개월 전 | 327 | |
| 2649 |
선택과집중
|
5개월 전 | 423 | |
| 2648 | 5개월 전 | 441 | ||
| 2647 |
welcome
|
5개월 전 | 545 | |
| 2646 |
디지털홍익인간
|
5개월 전 | 453 | |
| 2645 | 5개월 전 | 466 | ||
| 2644 |
선택과집중
|
5개월 전 | 512 | |
| 2643 | 5개월 전 | 456 | ||
| 2642 | 5개월 전 | 372 | ||
| 2641 | 5개월 전 | 358 | ||
| 2640 | 5개월 전 | 394 | ||
| 2639 | 5개월 전 | 1358 | ||
| 2638 |
|
5개월 전 | 510 | |
| 2637 |
세르반데스
|
5개월 전 | 398 | |
| 2636 |
선택과집중
|
5개월 전 | 568 | |
| 2635 |
선택과집중
|
6개월 전 | 682 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기