채택완료

갤러리 게시판 목록에서 가로 2개씩 출력하게 하려면 어떻게 해야하는지좀 알려주세요.

2013-12-26 (목) 18:01:25 7,461
코드는 아래와 같습니다.
어느부분을 수정해야
가로 2개씩으로 목록사진을 나오게할수 있을까요?
현재는 한개씩 웹진형으로 출력되고 있습니다.
 
부탁드립니다. 감사합니다
 
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 7;
//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
// 썸네일 설정
$thumb_width = "400"; //썸네일 가로길이
$thumb_height = "400"; //썸네일 세로길이
$thumb_quality = "100"; //퀼리티 100이하로 설정
$list_content = "200"; //내용길이
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<!-- 게시판 목록 시작 -->
<style>
.brand_font {font-family:나눔고딕,돋움; font-size:12px; font-weight:bold; margin-left:5px; }
.brand_font a {color:#666666;text-decoration:none;}
.brand_font a:hover {color:#888888;text-decoration:none}
.subject_font {font-family:나눔고딕,돋움; font-size:20px; font-weight:bold; color:#}
.subject_font a {color:#4e4e4e;text-decoration:none;}
.subject_font a:hover {color:#888888;text-decoration:none}
.menu_font {font-family:나눔고딕,돋움; font-size:13px; }
.menu_font a {color:#444444;text-decoration:none;}
.menu_font a:hover {color:#888888;text-decoration:none}
</style>
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0><tr>       
<td align="center">
  <!-- 분류 셀렉트 박스, 게시물 몇건, 관리자화면 링크 -->
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
   <td align="left" width="100%">
   
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td ><?
    $cnt_bo_1 = $bo_1[0] ? $bo_1[0] : 9; // 한줄당 분류 갯수(현재:20)
    $cnt = 1;
    $cnt0 = 0;
    $bb_s=""; $bb_e="";
    $b_s=""; $b_e="";
    $arr = explode("|", $board[bo_category_list]); // 구분자가 , 로 되어 있음
    $str = " ";
    for ($i=0; $i<count($arr); $i++)
    if (trim($arr[$i]))  {
    if ($sca == $arr[$i]) { $cnt0++; $b_s="<b>"; $b_e="</b>"; } else {$b_s=""; $b_e="";}
    $sql1 = " SELECT count(*) as cCount FROM $write_table WHERE ca_name = '$arr[$i]' and wr_comment >= 0 ";//카테고리내용갯수표시
    $board1 = sql_fetch($sql1);//카테고리내용갯수표시 -> ($board1[cCount])
    $str .= "<span class='menu_font'><a href='./board.php?bo_table=$bo_table&sca=".($arr[$i])."'>$b_s$arr[$i]</a></span><span style='font-size:7.5pt;color:#FE5731;line-height:17px;'>($board1[cCount])$b_e</span>&nbsp;<font color='#CCCCCC'>|</font>&nbsp;";
    if ($cnt == $cnt_bo_1) { $cnt = 0; $str .= "<br>"; }
    $cnt++;
    }
    if ($cnt0 == 0 ) { $bb_s="<b>"; $bb_e="</b>"; }
    ?>
    <?echo "  ";echo $bb_s;?><span class='menu_font'><a href="board.php?bo_table=<?=$bo_table?>&page=<?=$page?>">&nbsp;전체</a></span>
    </td>
    <td width="10"></td>
    <td align="left"><?=$bb_e?><?=$str?></td>
   </tr>
            </table><!-- 제품카테고리 -->
   
   </td>
          </tr>
         <tr>
   <td  style="padding-top:10px;"><div style="background:#dddddd; height:1px"></div></td>
  </tr>
      </table><? if ($admin_href) { ?>
  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
   <td height="5" colspan="2"></td>
  </tr>
  <tr>
  <td align="left" width="50%"> <? if ($is_checkbox) { ?><a href="javascript:select_delete();"><img src="<?=$board_skin_path?>/img/s_ui03.png" align="absmiddle" border='0'></a>&nbsp;&nbsp;<? } ?> 
   <? if ($write_href) { ?><a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/s_ui02.png"></a>  <? } ?></td>
  <TD  align="right" width="50%"><a href="<?=$admin_href?>"><img src="<?=$board_skin_path?>/img/btn_admin.gif" border='0' title="관리자" align="absmiddle"></a></TD>
  </tr>
  </table>
           <?}?>
<!-- 제목 -->
<form name="fboardlist" method="post" style="margin:0;">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl'  value='<?=$sfl?>'>
<input type='hidden' name='stx'  value='<?=$stx?>'>
<input type='hidden' name='spt'  value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw'   value=''>

<? for ($i=0; $i<count($list); $i++) { ?> <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center"  style="padding-top:20px;">
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td valign="top">
   
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="300" rowspan="2" valign="top">
    <?
//썸네일 생성
$thumfile = "";
    $thumb = $thumb_path.'/'.$list[$i][wr_id];
    // 썸네일 이미지가 존재하지 않는다면
    if (!file_exists($thumb)) {
        $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
        // 업로드된 파일이 이미지라면
        if (preg_match("/\.(jpg|gif|png)$/i", $file) && file_exists($file)) {
            $size = getimagesize($file);
            if ($size[2] == 1)
                $src = imagecreatefromgif($file);
            else if ($size[2] == 2)
                $src = imagecreatefromjpeg($file);
            else if ($size[2] == 3)
                $src = imagecreatefrompng($file);
            else
                continue;
            $rate = $thumb_width / $size[0];
            $height = (int)($size[1] * $rate);
            // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
            if ($height < $thumb_height)
                // 계산된 이미지 높이로 복사본 이미지 생성
                $dst = imagecreatetruecolor($thumb_width, $height);
            else
                // 설정된 이미지 높이로 복사본 이미지 생성
                $dst = imagecreatetruecolor($thumb_width, $thumb_height);
            imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
            imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $thumb_quality);
            chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
        } else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
   $edit_img = $list[$i]['wr_content'];
   if (eregi("data/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)", $edit_img, $tmp)) { // data/cheditor------
    $file = '../' . $tmp[0]; // 파일명
    $size = getimagesize($file);
    if ($size[2] == 1)
     $src = imagecreatefromgif($file);
    else if ($size[2] == 2)
     $src = imagecreatefromjpeg($file);
    else if ($size[2] == 3)
     $src = imagecreatefrompng($file);
    else
     continue;
    $rate = $thumb_width / $size[0];
    $height = (int)($size[1] * $rate);
    // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
    if ($height < $thumb_height)
     // 계산된 이미지 높이로 복사본 이미지 생성
     $dst = imagecreatetruecolor($thumb_width, $height);
    else
     // 설정된 이미지 높이로 복사본 이미지 생성
     $dst = imagecreatetruecolor($thumb_width, $thumb_height);
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
    imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $thumb_quality);
    chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
   }
     }
 }
//이미지
    if (file_exists($thumb))
        $thumfile = "<img src='{$thumb}' border='0' width='300;' height='180' >";
  else
  //이미지가 없으면
  $thumfile="";
  //이미지가 아니면
        if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file)){
  $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$thumb_width', '$thumb_height', 'transparent'));</script>";
     }
?> 
    <? if ($thumfile) {// 썸네일 ?> 
 <a href='<?=$list[$i][href]?>'><?=$thumfile?></a> 
 <? }?> 
    </td>
                <td valign="top" style="padding-left:20px;"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="left" valign="top">
     
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td align="left" >   
      
       <table width="100%" border="0" cellpadding="0" cellspacing="0">
       <tr>
      <td align="left"> 
      
       <table height="31" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td><img src="<?=$g4[path]?>/shop/image/s_txtbg01.png"></td>
                              <td height="31" valign="middle" background="<?=$g4[path]?>/shop/image/s_txtbg02.png">
        
  <? if ($is_checkbox) { ?>
     <input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"><? } ?> <?
        echo $nobr_begin;
        echo $list[$i][reply];
        echo $list[$i][icon_reply];
        if ($is_category && $list[$i][ca_name]) {
            echo "<span class=small><span class='brand_font'><a href='{$list[$i][ca_name_href]}'>{$list[$i][ca_name]}</a></font></span> ";
        }
        $style = "";
        if ($list[$i][is_notice]) $style = " style='font-weight:bold;'";
        if ($list[$i][wr_4] > 4 || $list[$i][wr_6]) {
       echo "<a href='{$list[$i][href]}' $style>";
       echo "<s>불량자료로 신고가 접수된 게시물입니다</s>";
       echo "</a>";
       } else {
     /*
        echo "<a href='{$list[$i][href]}' $style><span style='font-size:12px;font-family:굴림;letter-spacing:-1px;font-weight:bold;'>";
        echo $list[$i][subject];
        echo "</span></a>";
  */
        if ($list[$i][comment_cnt])
            echo " <a href=\"{$list[$i][comment_href]}\"><span style='font-family:Tahoma;font-size:10px;color:#EE5A00;'>{$list[$i][comment_cnt]}</span></a>";
        // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
        // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
        echo " " . $list[$i][icon_new];
        echo " " . $list[$i][icon_link];
        echo " " . $list[$i][icon_hot];
        echo " " . $list[$i][icon_secret];
        echo $nobr_end;
 }
        ?>
         </td>
                              <td><img src="<?=$g4[path]?>/shop/image/s_txtbg03.png"></td>
                            </tr>
                        </table></td>
                        <td align="right"><table border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td >
         <? if ($admin_href) { ?><a href="<?=$g4[path]?>/bbs/write.php?w=u&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&page="><img src="<?=$g4[path]?>/shop/image/s_ui05.png" alt="수정" align="absmiddle"></a>&nbsp;&nbsp;<? }?>
        
         <?php
/////////////////////////////////////////////////////////////////////////////////////////////
// UTF전용
$subject_con = $list[$i][subject];
/////////////////////////////////////////////////////////////////////////////////////////////
// 현제 페이지 주소 추출
$board_url = "http://".$_SERVER['SERVER_NAME']."/bbs/board.php?bo_table=".$bo_table."&wr_id=".$list[$i][wr_id];
/////////////////////////////////////////////////////////////////////////////////////////////
// 페이스북
/////////////////////////////////////////////////////////////////////////////////////////////
$face_url= $board_url;
$face_url = urlencode($face_url);
$face_subject = urlencode($subject_con);
// 추가
$face_content = strip_tags($list[$i][wr_content]);
$face_content = substr($face_content,0,750)."...";
$face_content = urlencode($face_content);
if($view[file][0][file]){
 $face_img = "http://".$_SERVER['SERVER_NAME']."/data/file/".$bo_table."/".$list[$i][file][0][file]; // 1번째 사진을 기본 썸네일로 지정
 $face_img = urlencode($face_img);
}
/////////////////////////////////////////////////////////////////////////////////////////////
$facebook_like = "http://".$_SERVER['SERVER_NAME']."/bbs/board.php?bo_table=".$bo_table."&wr_id=".$wr_id;
/////////////////////////////////////////////////////////////////////////////////////////////
?>
 <img src="<?=$board_skin_path?>/img/icon/facebook.png" border="0" onclick="window.open('http://www.facebook.com/sharer/sharer.php?s=100&p%5Btitle%5D=<?=$face_subject?>&p%5Burl%5D=<?=$face_url?>&p%5Bimages%5D%5B0%5D=<?=$face_img?>&p%5Bsummary%5D=<?=$face_content?>','window','width=600,height=430')" style="cursor:pointer" alt="게시글을 facebook으로 보내기"></td>
                            </tr>
                        </table></td>
                      </tr>
                    </table></td>
                  </tr>
                 
                  <tr>
                    <td align="left" style="padding-top:10px; padding-left:5px;">
     
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td align="left" class="subject_font" style="line-height:30px; padding-left:3px"><a href='<?=$list[$i][href]?>'><?=$list[$i][wr_subject]?></a></td>
                        </tr>
                    </table>
     
     </td>
                  </tr>
                  <tr>
                    <td align="left"  style="padding-top:10px;  padding-left:8px; line-height:20px;"><a href="<?=$list[$i][href]?>"><?=cut_str(strip_tags($list[$i][wr_content]),900,"…")?></a><br>
     <a href="<?=$list[$i][href]?>"><img src="<?=$g4[path]?>/shop/image/s_ui04.png" border="0" alt="자세히보기" vspace="10"></a>
     </td>
                  </tr>
                </table></td>
              </tr>            
            </table>
                </td>
              </tr>
        </table>
    </td>
          </tr>
        </table>
  </td>
        </tr>
    </table>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="30"></td>
                </tr>
                <tr>
                  <td style="background-color:#cccccc; height:1px"></td>
                </tr>
     <tr>
                  <td height="10"></td>
                </tr>
        </table 
><?}?>

</form>

<div style="margin-top:7px; right:0px;  height:31px; clear:both;">
    <div style="float:right; padding-top:15px;" >
        <? if ($is_checkbox) { ?>
        <a href="javascript:select_delete();"><img src="<?=$board_skin_path?>/img/s_ui03.png" align="absmiddle" border='0'></a>&nbsp;&nbsp;
        <? } ?> 
         <? if ($write_href) { ?><a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/s_ui02.png"></a>  <? } ?>
    </div>
</div>
<!-- 페이지 -->
<div style="font-family:gulim; text-align:center; line-height:30px; margin-top:5px; margin-right:0; margin-bottom:10px; margin-left:0; padding-top:5px; padding-right:0; padding-bottom:5px; padding-left:0; clear:both;">
    <? if ($prev_part_href) { echo "<a href='$prev_part_href'><img src='$board_skin_path/img/page_search_prev.gif' border=0 align=absmiddle title='이전검색'></a>"; } ?>
    <?
    // 기본으로 넘어오는 페이지를 아래와 같이 변환하여 이미지로도 출력할 수 있습니다.
    //echo $write_pages;
    $write_pages = str_replace("처음", "<img src='$board_skin_path/img/page_begin.gif' border='0' align='absmiddle' title='처음'>", $write_pages);
    $write_pages = str_replace("이전", "<img src='$board_skin_path/img/page_prev.gif' border='0' align='absmiddle' title='이전'>", $write_pages);
    $write_pages = str_replace("다음", "<img src='$board_skin_path/img/page_next.gif' border='0' align='absmiddle' title='다음'>", $write_pages);
    $write_pages = str_replace("맨끝", "<img src='$board_skin_path/img/page_end.gif' border='0' align='absmiddle' title='맨끝'>", $write_pages);
    $write_pages = preg_replace("/<span>([0-9]*)<\/span>/", "<b><span style=\"color:#B3B3B3; font-size:12px;\">$1</span></b>", $write_pages);
    $write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><span style=\"color:#4D6185; font-size:12px; text-decoration:underline;\">$1</span></b>", $write_pages);
    ?>
    <?=$write_pages?>
    <? if ($next_part_href) { echo "<a href='$next_part_href'><img src='$board_skin_path/img/page_search_next.gif' border=0 align=absmiddle title='다음검색'></a>"; } ?>
</div>
<!-- 링크 버튼, 검색 -->
<div style="text-align:center;">
</div>
</td></tr>
</table>
<script language="JavaScript">
if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';
if ('<?=$stx?>') {
    document.fsearch.sfl.value = '<?=$sfl?>';
    if ('<?=$sop?>' == 'and')
        document.fsearch.sop[0].checked = true;
    if ('<?=$sop?>' == 'or')
        document.fsearch.sop[1].checked = true;
} else {
    document.fsearch.sop[0].checked = true;
}
</script>
<? if ($is_checkbox) { ?>
<script language="JavaScript">
function all_checked(sw) {
    var f = document.fboardlist;
    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]")
            f.elements[i].checked = sw;
    }
}
function check_confirm(str) {
    var f = document.fboardlist;
    var chk_count = 0;
    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
            chk_count++;
    }
    if (!chk_count) {
        alert(str + "할 게시물을 하나 이상 선택하세요.");
        return false;
    }
    return true;
}
// 선택한 게시물 삭제
function select_delete() {
    var f = document.fboardlist;
    str = "삭제";
    if (!check_confirm(str))
        return;
    if (!confirm("선택한 게시물을 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다"))
        return;
    f.action = "./delete_all.php";
    f.submit();
}
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
    var f = document.fboardlist;
    if (sw == "copy")
        str = "복사";
    else
        str = "이동";
    if (!check_confirm(str))
        return;
    var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
    f.sw.value = sw;
    f.target = "move";
    f.action = "./move.php";
    f.submit();
}
</script>
<? } ?>
<!-- 게시판 목록 끝 -->
|

답변 3개

채택된 답변
+20 포인트
<? for ($i=0; $i<count($list); $i++) { ?> 이것 시작하는 것부터 끝까지 뜯어고쳐야 겠네요

방법은 저 밑에줄에 table로 시작하는 부분에 2개씩 보여주게 만들어 주는것이고 

gallery스킨 아무거나 받아보시면 자세하게 나와있습니다. 

ul li를 이용해서 스타일로 맞추면 바로 해결되겠네요


2018-04-13 (금) 15:30:20
많은 도움이 되었습니다. 감사합니다.
2013-12-31 (화) 22:08:28
답변감사합니다..
조금만 자세히 알려주시면 안될까요??
죄송합니다 ㅠㅠ

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