답변 2개 / 댓글 1개
채택된 답변
+20 포인트
Copy
<?php
function display_latest_post($bo_table, $latest_post_id) {
global $g5;
// 인덱스용 게시판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']);
}
// 게시물 정보 가져오기
$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', 1);
display_latest_post('free', 2);
?>
<?php
$bo_tables = ['free','gallery']; // 'free', 여러 개의 인덱스용 게시판id
foreach ($bo_tables as $bo_table) {
$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('인덱스용 게시판이 생성되지 않았습니다: ' . $bo_table);
continue; // 다음 게시판으로 넘어감
}
if (defined('G5_IS_MOBILE') && 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']);
}
include(G5_BBS_PATH . '/list.php');
}
?>
답변을 작성하려면 로그인이 필요합니다.