채택완료

여러게시물 최신글 질문입니다.

2017-07-21 (금) 20:39:36 3,752

latest.php

Copy
// $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;}

index.php

Copy
<div><h1>새글</h1></div>          <div class="main_new">             <?php               echo latest_all("basic","Notice,Notice",5,50);?>          </div>

PMA

917f8c627156b1e92a6f3e8c56692932_1500637097_86.png
 

g5_board 에 있는 데이터 하나를 빼서 g5_board_new에 넣었는데

계속 게시물이 없다고 뜹니다.

g5_board에 있는 게시물 중 최신글 몇개가 나와야 하는거 아닌가요 ?

답변 1개 / 댓글 2개

채택된 답변
+20 포인트
2017-07-21 (금) 21:22:23

마지막 pma 스샷 전체를 보여 주세요.

bo_table 칼럼 옆에 더 있습니다.

그걸 다 보여 주셔야 할 것 같네요.

답변에 대한 댓글 2개

메일로 보내드리겠습니다.
g5_board_new 테이블은
bn_id
bo_table
wr_id
wr_parent
bn_datetime
mb_id
칼럼이 이게 전부 아닌가요?
지금 보내신 건 g5_board 테이블 같네요.
최근 게시물에서 사용하는 테이블은 g5_board_new 테이블입니다.

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