최신 갤러리에서 php질문입니다. 정보
최신 갤러리에서 php질문입니다.본문
안녕하세요.
유아원님 심플최신글을 사용하고 있습니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=87375&sca=&sfl=wr_name%2C1&stx=%C0%AF%BE%C6%BF%F8&sop=and
위의 구조는 2개의 최신이미지가 나오고 3개 최신글이 추출되는 구조입니다.
최신글은 말고, 최신이미지가 5개가 나오도록 하려는되 잘안되서 질문드립니다.
소스코드가 아래와 같으데 고수님들 알려주시면 감사하겠습니다~^^;;
<?
if (!defined("_GNUBOARD_")) exit;
// 썸네일 생성
$thumb_width = "90"; //썸네일 가로길이
$thumb_height = "55"; //썸네일 세로길이
// 1차 테이블 디렉토리
$table_path = $g4['path'] . "/data/thumb/" . $bo_table;
// 1차 디렉토리 생성 및 퍼미션
@mkdir($table_path, 0707);
@chmod($table_path, 0707);
// 썸네일 디렉토리
$thumb_path = $table_path . "/" . $thumb_width . "x" . $thumb_height;
// 디렉토리 생성 및 퍼미션
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
// 돌리고 돌리고~
for ($i=0; $i<count($list); $i++) {
if ($i == '0' || $i == '1') {
// 첨부파일
$listFile = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '{$bo_table}' and wr_id = '{$list[$i][wr_id]}' and bf_type in(1,2,3) ");
// 파일
if ($listFile['bf_file']) {
// 썸네일
$thumb = $thumb_path.'/'.$listFile['bf_file'];
// 원본
$thumb_file = "{$g4[path]}/data/file/{$bo_table}/{$listFile['bf_file']}";
// 파일명
$img_filename = "{$listFile['bf_file']}";
} else {
// 에디터
// 내용뽑고
$img_content = "{$list[$i]['wr_content']}";
$img_tmp1 = stristr($img_content,'/data/geditor/'); // 지에디터 디렉토리 체크
$img_tmp2 = strpos($img_tmp1,'>'); // 닫고
$img_tmp3 = stristr(substr($img_tmp1,0,$img_tmp2+1),'geditor'); // 지에디터 부터 경로 시작
$img_tmp4 = substr($img_tmp3,0,strpos($img_tmp3,'"')); // 더블쿼트 이전까지
$img_fileurl = $g4['path']."/data/".$img_tmp4; // 원본파일 상대경로
// 디렉토리에 파일이 있다면.
if (file_exists($img_fileurl)) {
// 파일명
$img_filename = substr($img_tmp4,13);
} else {
// 파일명이 읍네 ?
$img_filename = "";
}
// 썸네일
$thumb = $thumb_path.'/'.$img_filename;
// 원본
$thumb_file = "{$img_fileurl}";
}
// 썸네일이 없다면
if (!file_exists($thumb)) {
// 확장자 체크
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $thumb_file) && file_exists($thumb_file)) {
// 썸네일 생성. 가로, 세로, 원본경로, 생성경로
createThumb($thumb_width, $thumb_height, $thumb_file, $thumb, true);
}
}
if (file_exists($thumb) && $img_filename) {
$img[$i] = "<a href='".$list[$i]['href']."' onfocus='this.blur();'><img src='".$thumb."' width='".$thumb_width."' height='".$thumb_height."' align='absmiddle' border='0'></a>";
} else {
$img[$i] = "";
}
// 제목
$subject[$i] = conv_subject($list[$i]['wr_subject'], '30', '');
// 링크
$link[$i] = $list[$i]['href'];
} else {
// 제목
$subject2 = conv_subject($list[$i]['wr_subject'], $subject_len, '');
// 돌린다.
$add_list .= "<dl class='list'><a href='".$list[$i]['href']."' class='text'>· ".$subject2."</a></dl>";
}
}
if (count($list) == 0) {
$img[0] = "<span class='text'>no image</span>";
$link[0] = "#";
$subject[0] = "<span class='text'>게시물이 없습니다.</span>";
$img[1] = "<span class='text'>no image</span>";
$link[1] = "#";
$subject[1] = "<span class='text'>게시물이 없습니다.</span>";
$add_list = "<span class='text'>게시물이 없습니다.</span>";
}
?>
<style type="text/css">
div, ul, li, dl{padding:0px; margin:0px;}
ul, li {list-style:none outside;}
#box {border:1px solid #dddddd;}
#box .side {height:105px; padding:5px 3px 0 3px;}
#box .image {width:100px; padding-left:8px; float:left;}
#box .image_list {height:95px; padding-left:8px; float:left;}
#box .photo {width:90px; height:55px; padding:3px; border:1px solid #e4e4e4;}
#box .photo_list {width:90px; height:32px; line-height:15px; margin-top:3px; text-align:center;}
#box .list {height:19px;}
#box .text {color:#747474; font-size:11px; font-family:dotum,돋움;}
</style>
<div id="box">
<ul class="side">
<li class="image"><dl class="photo"><?=$img[0]?></dl><dl class="photo_list"><a href="<?=$link[0]?>" class="text"><?=$subject[0]?></a></dl></li>
<li class="image"><dl class="photo"><?=$img[1]?></dl><dl class="photo_list"><a href="<?=$link[1]?>" class="text"><?=$subject[1]?></a></dl></li>
<li class="image_list">
<?=$add_list?>
</li>
</ul>
</div>
댓글 전체
다음에 2번째 줄에서
if ($i == '0' || $i == '1') {
이 부분을 if ($i < 6) 으로 바꿔주세요.
그래도 아키시엘님 답변감사합니다~