[최근게시물] 2단으로 만들기

s.JPG
현재 최근게시물 스킨을 받아서 사용중입니다.

최근게시물 lastest.skin.php 의 내용은

아래와 같구요

현재 출력되는 모습은 첨부파일과 같습니다.

현재 1단으로 출력되고 있는데 2단으로 출력하기 위해서는 소스중에

어디를 손봐야 할지를 모르겠습니다^^

고수님들의 답변 부탁드립니다~

=============================================


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

$elpisbuilder1=120;
$elpisbuilder2=100;
$elpisbuilder3=$subject_len;

if (!$elpisbuilder1) alert("해당 게시판 설정 : 여분 필드 4 에 목록에서 보여질 이미지의 폭을 설정하십시오. (픽셀 단위)");
if (!$elpisbuilder2) alert("해당 게시판 설정 : 여분 필드 5 에 목록에서 보여질 이미지의 질(quality)을 비율로 설정하십시오. (100 이하)");
if (!$elpisbuilder3) alert("게시판 설정 : 여분 필드 8 에 목록에서 내용길이를 입력하십시오.");
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 스킨 입니다.");

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb100';

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);

?>

<!-- 최신글 제목 -->
<table width="40%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><? for ($i=0; $i<count($list); $i++) { ?>
<? if ($i==i) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<!-- <tr><td bgcolor="#EEEEEE" width="100%" height="1"></td></tr> -->
<tr>
<td height="7"></td>
</tr>
<tr>
<?
{
if ($i > 0)
echo "<tr><td width=20>&nbsp;</td></tr>";

$img = "<img src='$latest_skin_path/img/no_image.gif' border=0 title='이미지 없음'>";
$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("/\.(jp[e]?g|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
break;

$rate = $elpisbuilder1 / $size[0];
$height = (int)($size[1] * $rate);

$dst = imagecreatetruecolor($elpisbuilder1, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $elpisbuilder1, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $elpisbuilder2);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}

if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";

$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
$subject = "<span $style>".cut_str($list[$i][subject],1000)."</span>";
$wr_content = "<span $style>".cut_str($list[$i][wr_content],$elpisbuilder3)."</span>";

echo <<<HEREDOC
<td style='word-break:break-all;' valign="top" align="left">
<table width='{$td_width}%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td width='100' height='75' align='center' valign='top'>
<table border='0' width='100' cellpadding='3' cellspacing='1' bgcolor='#999999'>
<tr>
<td bgcolor='white'>
<div style='width:100px; height:75px; position: relative; overflow:hidden;' align=center><a href='{$list[$i][href]}'>{$img}</a></div>
</td>
</tr>
</table>
</td>
<td>
</td>
<td valign='top'>
<table width='{$td_width}%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td height='20' style='padding:0 10' valign='top'><a href='{$list[$i][href]}'><strong><font color='#6A6A6A'>{$subject}</font></strong></a>{$comment_cnt} {$list[$i][icon_new]}</td>
</tr>

<tr>
<td style='padding:0 10' valign='top'><a href='{$list[$i][href]}'><font color='#6A6A6A'>{$wr_content}</font> <!-- <font color='#999999'>[{$list[$i][datetime]}]</font> --></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
HEREDOC;
}
?>
</tr>
</table>
<? } ?>
<? if ($i==1) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<?
{
if ($i > 0)
echo "<tr><td width=20 height=7></td></tr>";

$img = "<img src='$latest_skin_path/img/no_image.gif' border=0 title='이미지 없음'>";
$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("/\.(jp[e]?g|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
break;

$rate = $elpisbuilder1 / $size[0];
$height = (int)($size[1] * $rate);

$dst = imagecreatetruecolor($elpisbuilder1, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $elpisbuilder1, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $elpisbuilder2);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}

if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";

$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
$subject = "<span $style>".cut_str($list[$i][subject],1000)."</span>";
$wr_content = "<span $style>".cut_str($list[$i][wr_content],$elpisbuilder3)."</span>";

echo <<<HEREDOC
<td style='word-break:break-all;' valign="top" align="left">
<table width='{$td_width}%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td width='100' height='75' align='center' valign='top'>
<table border='0' width='100' cellpadding='3' cellspacing='1' bgcolor='#999999'>
<tr>
<td bgcolor='white'>
<div style='width:100px; height:75px; position: relative; overflow:hidden;' align=center><a href='{$list[$i][href]}'>{$img}</a></div>
</td>
</tr>
</table>
</td>
<td>
</td>

<td valign='top'>
<table width='{$td_width}%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td height='20' style='padding:0 10' valign='top'><a href='{$list[$i][href]}'><strong><font color='#6A6A6A'>{$subject}</font></strong></a>{$comment_cnt} {$list[$i][icon_new]}</td>
</tr>

<tr>
<td style='padding:0 10' valign='top'><a href='{$list[$i][href]}'><font color='#6A6A6A'>{$wr_content}</font> <!-- <font color='#999999'>[{$list[$i][datetime]}]</font> --></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
HEREDOC;
}
?>
</tr>
</table>
<? } ?>
<? if ($i==2) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<?
{
if ($i > 0)
echo "<tr><td width=20 height=7></td></tr>";

$img = "<img src='$latest_skin_path/img/no_image.gif' border=0 title='이미지 없음'>";
$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("/\.(jp[e]?g|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
break;

$rate = $elpisbuilder1 / $size[0];
$height = (int)($size[1] * $rate);

$dst = imagecreatetruecolor($elpisbuilder1, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $elpisbuilder1, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $elpisbuilder2);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}

if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";

$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
$subject = "<span $style>".cut_str($list[$i][subject],1000)."</span>";
$wr_content = "<span $style>".cut_str($list[$i][wr_content],$elpisbuilder3)."</span>";

echo <<<HEREDOC
<td style='word-break:break-all;' valign="top" align="left">
<table width='{$td_width}%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td width='100' height='75' align='center' valign='top'>
<table border='0' width='100' cellpadding='3' cellspacing='1' bgcolor='#999999'>
<tr>
<td bgcolor='white'>
<div style='width:100px; height:75px; position: relative; overflow:hidden;' align=center><a href='{$list[$i][href]}'>{$img}</a></div>
</td>
</tr>
</table>
</td>
<td>
</td>

<td valign='top'>
<table width='{$td_width}%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td height='20' style='padding:0 10' valign='top'><a href='{$list[$i][href]}'><strong><font color='#6A6A6A'>{$subject}</font></strong></a>{$comment_cnt} {$list[$i][icon_new]}</td>
</tr>

<tr>
<td style='padding:0 10' valign='top'><a href='{$list[$i][href]}'><font color='#6A6A6A'>{$wr_content}</font> <!-- <font color='#999999'>[{$list[$i][datetime]}]</font> --></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
HEREDOC;
}
?>
</tr>
<tr>
<td height="7"></td>
</tr>
<tr>
<td background="<?=$latest_skin_path?>/img/btn_line_bg.gif" width="520" height="1"></td>
</tr>
<tr>
<td height="7"></td>
</tr>
</table>
<? } ?>
<? if ($i<3) { ?>
<? } else { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="20" align="center" valign="middle"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13" /></td>
<td style='word-break:break-all;'><?
echo $list[$i][icon_reply] . " ";
echo "<a href='{$list[$i][href]}'>";
if ($list[$i][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i][subject]}</font>";
echo "</a>";

if ($list[$i][comment_cnt])
echo " <a href=\"{$list[$i][comment_href]}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$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];
?>
</td>
<td align="right"><font style="font-size:8pt;" color="#999999">[
<?=$list[$i][datetime]?>
]</font></td>
<td width="15"></td>
</tr>
</table>
<? } ?>
<? } ?>
</td>
</tr>
</table>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 시작 --><!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 끝 -->


==============================================

첨부파일

s.JPG (151.8 KB)
0회 2008-05-24 13:43
|

댓글 3개

막연하게 이렇게 소스 다 올리면 어렵죵~

<table>
<tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<td>내용</td>
<? } ?>
</tr>
</table>

위와 같이 for 문을 td 사이에 넣는다면 가로로만 늘어나겠죠.

아래와 같이 tr 사이에 넣는다면 세로로만 늘어나겠죠.

<table>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td>내용</td>
</tr>
<? } ?>
</table>
제가 프로그램적인 지식이 많이 부족하구요 ㅠ

워낙 html 이 아닌 부분이 많아서 for문을 구분하기 조차 어려워서 일단 소스를 다 올린

것이구요~;;

아무튼 답변 감사드려요 ㅠ
첫번째 결과

<table>
<tr>
<td>내용</td>
<td>내용</td>
<td>내용</td>
<td>내용</td>
<td>내용</td>
</tr>
</table>
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
17년 전 조회 740
17년 전 조회 1,063
17년 전 조회 803
17년 전 조회 754
17년 전 조회 1,035
17년 전 조회 869
17년 전 조회 3,017
17년 전 조회 730
17년 전 조회 815
17년 전 조회 789
17년 전 조회 1,598
17년 전 조회 722
17년 전 조회 740
17년 전 조회 778
17년 전 조회 769
17년 전 조회 1,206
17년 전 조회 1,531
17년 전 조회 833
17년 전 조회 928
17년 전 조회 764
🐛 버그신고