인덱스에서 뷰 페이지 보기(최근글)
<?php
$bo_table = 'free'; // 인덱스용 게시판id
$write_table = $g5['write_prefix'] . $bo_table;
$board = sql_fetch("select * from {$g5['board_table']} where bo_table = '$bo_table'");
if (!$board['bo_table']) {
alert_close('인덱스용 게시판이 생성되지 않았습니다.');
}
if (G5_IS_MOBILE) {
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
} else {
$board_skin_path = get_skin_path('board', $board['bo_skin']);
$board_skin_url = get_skin_url('board', $board['bo_skin']);
}
// 최종 게시물 가져오기
$latest_post = sql_fetch("select * from {$write_table} order by wr_id desc limit 1");
if (!$latest_post['wr_id']) {
alert_close('게시물이 존재하지 않습니다.');
}
// 게시물 정보 가져오기
$view = sql_fetch("select * from {$write_table} where wr_id = {$latest_post['wr_id']}");
if (!$view['wr_id']) {
alert_close('게시물을 찾을 수 없습니다.');
}
// 스킨 파일 포함
include($board_skin_path . '/view.skin.php');
// 뷰 페이지 경로 설정
include_once(G5_BBS_PATH . '/view.php');
?>
--------------------------------------- 추 가 -------------------------------------------------
<div class="latest_wr">
<?php
function display_latest_post($bo_table, $latest_post_id) {
global $g5;
$write_table = $g5['write_prefix'] . $bo_table;
$board = sql_fetch("select * from {$g5['board_table']} where bo_table = '$bo_table'");
if (!$board['bo_table']) {
alert_close('인덱스용 게시판이 생성되지 않았습니다.');
}
if (G5_IS_MOBILE) {
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
} else {
$board_skin_path = get_skin_path('board', $board['bo_skin']);
$board_skin_url = get_skin_url('board', $board['bo_skin']);
}
$view = sql_fetch("select * from {$write_table} where wr_id = {$latest_post_id}");
if (!$view['wr_id']) {
alert_close('게시물을 찾을 수 없습니다.');
}
include($board_skin_path . '/view.skin.php');
}
display_latest_post('free', 20); //게시판, 글번호
display_latest_post('free', 10); //게시판, 글번호
?>
</div>
댓글 8개
와 이거 초기화면 디자인 하는데 유용하겠군요
감사합니다 필요한 기능이었습니다^^
@미키손 추천 감사 합니다.
감사합니다
@장군22 감사 합니다. 게시판 2개의 게시글을 정해서 가져오는 코드 올렸습니다.
감사합니다 ^^
@민트다이어리 감사 합니다.
감사합니다.
@써맨 감사 합니다.
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4427 | ||
| 2604 | 8개월 전 | 676 | ||
| 2603 | 8개월 전 | 735 | ||
| 2602 | 8개월 전 | 649 | ||
| 2601 |
|
8개월 전 | 672 | |
| 2600 |
|
8개월 전 | 580 | |
| 2599 | 8개월 전 | 809 | ||
| 2598 | 8개월 전 | 604 | ||
| 2597 |
다케미카코
|
8개월 전 | 757 | |
| 2596 | 9개월 전 | 854 | ||
| 2595 |
|
9개월 전 | 446 | |
| 2594 | 9개월 전 | 608 | ||
| 2593 |
만두먹고또먹고
|
9개월 전 | 938 | |
| 2592 | 9개월 전 | 614 | ||
| 2591 | 9개월 전 | 620 | ||
| 2590 | 9개월 전 | 690 | ||
| 2589 |
|
9개월 전 | 760 | |
| 2588 | 9개월 전 | 479 | ||
| 2587 | 9개월 전 | 796 | ||
| 2586 | 9개월 전 | 645 | ||
| 2585 | 9개월 전 | 511 | ||
| 2584 | 9개월 전 | 579 | ||
| 2583 | 9개월 전 | 499 | ||
| 2582 | 9개월 전 | 644 | ||
| 2581 | 9개월 전 | 601 | ||
| 2580 |
만두먹고또먹고
|
9개월 전 | 517 | |
| 2579 |
|
9개월 전 | 666 | |
| 2578 | 9개월 전 | 649 | ||
| 2577 | 9개월 전 | 629 | ||
| 2576 | 10개월 전 | 562 | ||
| 2575 |
이슈DEV
|
10개월 전 | 993 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기