채택완료

최근 갤러리게시물을 두줄로 6개가 나오게 하려면

2016-01-22 (금) 21:42:53 7,647

ff97e6509ecb15ae3f2cd11215e04fb9_1453466300_9051.jpg

위의 이미지처럼 최근 갤러리게시물을 두줄로 6개가 나오게 하려면

아래 파일 중 어느부분을 어떻게 수정해야 하나요?

도와주세요.^^

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$cols  = 4; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$imgwidth=235; //표시할 이미지의 가로사이즈
$imgheight=170; //표시할 이미지의 세로사이즈
$image_h  = 10; // 이미지 상하 간격

$col_width = (int)(100 / $cols);

$data_path = $g4[path]."/data/file/$bo_table";
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="10"><!--여백--></td>
  </tr>
  <tr>
    <td align="center" valign="top"> 
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
   <? for ($i=0; $i<count($list); $i++) {
     if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
   ?>    
   <td width="<?=$col_width?>%" align="center" valign="top">
   <?
   $image = $list[$i][file][0][file]; //원본
   $img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
   
    echo $list[$i][icon_reply] . " ";
    echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
    echo "<tr><td valign='top' align='center'><a href='{$list[$i]['href']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='center' style='width:{$imgwidth}px;height:{$imgheight}px;border:1px solid #CECECE; padding:0px'></a></td></tr>";
    echo "<tr><td align='center' height='17'><br /><a href='{$list[$i]['href']}'><span style='font-size:10pt; color:#666666;'><b>{$list[$i]['subject']}</b></span></a></td></tr>";
   echo "</table>";
   ?>   </td>
   <? } ?>    
   <?
   $cnt = ($i%$cols);
   for ($k=$cnt; $k<$cols && $cnt; $k++) {
    echo "<td width=$col_width%></td>";
   }
   ?>
   <? if (count($list) == 0) { echo "<td height=80 align=center>...</td>"; } ?>   
    </tr>
  </table> </td>
  </tr>
</table> 

|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

$cols  = 4; //  이미지 가로갯수

여기서 4를 3으로 수정하고.. 

최신글 추출 부분에서 추출 개수를 6으로 하세요.

<?=latest("스킨명", "게시판아이디", 6, 25);?> 

답변에 대한 댓글 1개

적용되었어요. 죄송합니다. 제가 파일명이 오타나서...
감사합니다. 꾸벅~ ^^

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