답변 2개
</p><p>$sql = "SELECT * FROM ".$tmp_write_table." AS a LEFT JOIN g5_board_file AS b ON a.wr_id = b.wr_id WHERE a.wr_is_comment = 0 AND b.bo_table = '".$bo_table."' AND b.bf_width > 0 ORDER BY wr_num LIMIT 0, ".$rows;</p><p>
lib 디렉토리에 있는 latest.lib.php 파일을 여신 후에 49번째 줄에 있는 $sql을 위처럼 수정하셔도 될 것 같아요.
order by 앞에 b.bf_width > 0 이게 없으면 첨부 파일이 있으면 무조건 다 뜨게 되거든요.
그래서 이미지를 첨부했을 경우에 너비를 해당 칼럼에 입력하니까 저게 0보다 큰 경우는 이미지라 판단하고 저렇게 넣었네요.
답변에 대한 댓글 2개
지적 감사합니다.
중복으로 나오는 건 group by로 처리가 돼요.
근데 에디터로 집어 넣는 이미지의 경우는 따로 처리하셔야겠네요. ㅎ
댓글을 작성하려면 로그인이 필요합니다.
테스트 해보지는 못했습니다.
/www/bbs/write_update.php 에서 이미지 여부를 체크하신 담에
여분 필드 wr_1~10중에 적당한 필드에 이미지 여부 값을 넣은 담에
include_once(G5_LIB_PATH.'/thumbnail.lib.php'); $thumb = get_list_thumbnail($bo_table, $wr_id, $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb[src]){ $wr_1 = 'Y'; }else{ $wr_1 = 'N'; } sql_query("UPDATE {$write_table} SET wr_1 = '{$wr_1}' WHERE wr_id = '' "); if ($file_upload_msg) alert($file_upload_msg, G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.$qstr); else goto_url(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr);
/www/lib/latest.lib.php 에서
and wr_1 = 'Y' 으로 이미지 있는 것만 불러오시면 됩니다.
function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='') { 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_fwrite = false; if(G5_USE_CACHE) { $cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}.php"; if(!file_exists($cache_file)) { $cache_fwrite = true; } else { if($cache_time > 0) { $filetime = filemtime($cache_file); if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) { @unlink($cache_file); $cache_fwrite = true; } } if(!$cache_fwrite) include($cache_file); } } if(!G5_USE_CACHE || $cache_fwrite) { $list = array(); $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' "; $board = sql_fetch($sql); $bo_subject = get_text($board['bo_subject']); $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름 $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 and wr_1 = 'Y' order by wr_num 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); } if($cache_fwrite) { $handle = fopen($cache_file, 'w'); $cache_content = ""; fwrite($handle, $cache_content); fclose($handle); } } /* // 같은 스킨은 .css 를 한번만 호출한다. if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) { echo ''; $css[] = $skin_dir; } */ ob_start(); include $latest_skin_path.'/latest.skin.php'; $content = ob_get_contents(); ob_end_clean(); return $content; }
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
그리고 에디터로 이미지 올린 글들은 안 나올 꺼고요. ^^