최신글 lib 문의

최신글 lib 문의

QA

최신글 lib 문의

본문

https://sir.kr/g5_skin/1293?sfl=mb_id%2C1&stx=holystone

위 최신글 스킨을 사용하고 있습니다.

 

스킨에 첨부된 설명대로 <?php echo latest_sc("schedule", "게시판아이디", 5, 25); ?> 

이렇게하면 메인에서 최신글 자체가 노출이 안됩니다.

 

<?php echo latest("schedule", "게시판아이디", 5, 25); ?>로 썼더니

노출은 정상적으로 되는데 최신글 순서가 문제입니다.

 

5월부터 12월까지 입력했는데 12월 일정이 가장 첫번째 줄에 올라옵니다 ; 

어떤 부분을 수정하거나 살펴봐야하는지 모르겠습니다.

 

 

#### lib/latest.lib.php 마지막 줄(?> 윗줄)에 아래 내용 추가 ####

 


// 최신 스케줄 추출
function latest_sc($skin_dir='', $bo_table, $rows=10, $subject_len=40)
{
    global $g5;
    static $css = array();
    if (!$skin_dir) $skin_dir = 'basic';
    if(G5_IS_MOBILE) {
        $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
        $latest_skin_url  = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
    } else {
        $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
        $latest_skin_url  = G5_SKIN_URL.'/latest/'.$skin_dir;
    }
    $cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}.php";
    if (!G5_USE_CACHE || !file_exists($cache_file)) {
        $list = array();
        $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";
        $board = sql_fetch($sql);
        $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
        $sql = " select * from {$tmp_write_table}";        
        $sql .= " where wr_2 >= ".date('Ymd');
        $sql .= " order by wr_1 limit 0, {$rows} ";
        $result = sql_query($sql);
        for ($i=0; $row = sql_fetch_array($result); $i++) {
            $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);
        }
        $handle = fopen($cache_file, 'w');
        $cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$bo_subject=\"".get_text($board['bo_subject'])."\";\n\$list=".var_export($list, true)."?>";
        fwrite($handle, $cache_content);
        fclose($handle);
    }
    include_once($cache_file);
    ob_start();
    include $latest_skin_path.'/latest.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}

이 질문에 댓글 쓰기 :

답변 1

$sql .= " order by wr_2, wr_1 limit 0, {$rows} ";

이 부분 수정해보세요..

알려주신 lib/latest.lib.php 수정은 <?php echo latest_sc("schedule", "게시판아이디", 5, 25); ?> 이 함수로 추출할 때만 반영되는거 같아요. ㅠㅠ 고쳐서 latest_sc로 바꿔도 목록노출이 안되네요. 답변 감사합니다 ㅜ

답변을 작성하시기 전에 로그인 해주세요.
전체 7
QA 내용 검색

회원로그인

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