인덱스에서 뷰 페이지 보기(최근글) > 그누보드5 팁자료실

그누보드5 팁자료실

인덱스에서 뷰 페이지 보기(최근글) 정보

인덱스에서 뷰 페이지 보기(최근글)

본문

<?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>

 

추천
3

댓글 8개

전체 2,679 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT