채택완료

최신글 불러오기 문의 (기존글은 못불러와요)

2021-06-02 (수) 11:33:58 4,311

두개의 게시판을 한곳에 불러오는 최신글을 사용중인데요.

출력갯수에 10을 주던 30을 주던 정말 최근에 작성된 6개의 게시글만 불러오고 있어요...

기존의 게시글은 못불러오는 상황입니다.

무엇이 문제일까요?ㅠㅠ

메인에는 이렇게 적용되어있어요

<?php echo latest_all ("스킨명","게시판01,게시판02",30,10); ?>

latest.lib.php에 latest_all 부분입니다.

Copy
<?php
// $bo_tables 테이블들 사이 콤마(,) 단위로 구분해서 넣을 것, 콤마 사이에 공백 없이 (ex aaa,bbb,)
function latest_all($skin_dir='', $bo_tables, $rows=10, $subject_len=40, $cache_time=1, $options='')
{

    global $g5;

    if (!$skin_dir) $skin_dir = 'basic';

    if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
        if (G5_IS_MOBILE) {
            $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
            if(!is_dir($latest_skin_path))
                $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
        } else {
            $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
        }
        $skin_dir = $match[1];
    } else {
        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;
        }
    }

        $list = array();
        $sql_common = " from {$g5['board_new_table']} a  where find_in_set(a.bo_table, '{$bo_tables}')";
        $sql_common .= " and a.wr_id = a.wr_parent ";
        $sql_order = " order by a.bn_id desc ";
        $sql = " select a.* {$sql_common} {$sql_order} limit 0, {$rows}";

        $result = sql_query($sql);
        
        for ($i=0; $row=sql_fetch_array($result); $i++) {

            $sql = " select * from {$g5['board_table']} where bo_table = '{$row['bo_table']}' ";

          

            $board = sql_fetch($sql);

            $tmp_write_table = $g5['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, $board, $latest_skin_url, $subject_len);
            $list[$i]['bo_subject'] = $row['bo_subject'];
            $list[$i]['bo_table'] = $row['bo_table'];
        }

    ob_start();
    include $latest_skin_path.'/latest.skin.php';
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}
?>

답변 2개 / 댓글 2개

채택된 답변
+20 포인트

https://sir.kr/g5_plugin/4564

이거 받아서 실행하세요.

답변에 대한 댓글 1개

깔끔하게 해결되었어요~! 감사합니다^^
2021-06-02 (수) 12:29:52
{$g5['board_new_table']}

를 이용한 최신글에 생기는 문제입니다.

https://sir.kr/g5_plugin/4564

새로 갱신하시거나

https://sir.kr/g5_tip/15602

를 응용해 보세요.

답변에 대한 댓글 1개

응용부분이 적용이 안되어서ㅜㅜ 위의 방법으로 진행하여 해결되었어요 답변감사합니다^^

답변을 작성하려면 로그인이 필요합니다.