최신글 갤러리 도움좀 부탁드립니다. 정보
최신글 갤러리 도움좀 부탁드립니다.본문
최신글 갤러리를 만들었는데요.
ㅁㅁㅁ <- 이렇게 가로로 3개가 출력되는것을
ㅁㅁㅁ
ㅁㅁㅁ <- 이렇게 가로로 3개를 2단으로 출력하고 싶습니다.
고수분들의 가르침 부탁드립니다.
소스
<table width="499" cellspacing="0" cellpadding="0" bgcolor="#323232" border="0">
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
$list[$i]['content']=eregi_replace(" "," ",$list[$i]['content']);
if($list[$i][file][0][file])
{
$file = "<img src='".$list[$i][file][0][path] .'/'. $list[$i][file][0][file]."' width=\"157\" height=\"130\" border=\"0\" align=\"center\">";
}
else
{
$file="";
}
?>
<td width="163" height="185" valign="top">
<table width="163" height="185" cellspacing="0" cellpadding="0" style="background:url(<?=$g4['path']?>/images/box_bg.png); background-repeat:no-repeat"">
<tr>
<td width="163" height="1" colspan="2"></td>
</tr>
<tr>
<td width="2" height="130"></td>
<td width="157" height="130">
<table width="157" height="130">
<tr>
<td colspan='2'>
<a href="<?=$list[$i]['href']?>"><?=$file?></a>
</td>
<td width="2" height="130"></td>
</tr>
<tr>
<td width="163" height="1" colspan="3"></td>
</tr>
<tr>
<td width="2" height="50"></td>
<td width="157" height="50"></td>
<td width="2" height="50"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<?
}
?>
<? if(!count($list))
{
?>
<td align=center height=30><font color=#6A6A6A>게시물이 없습니다.</a></td>
<?
}
?>
</tr>
</table>
ㅁㅁㅁ <- 이렇게 가로로 3개가 출력되는것을
ㅁㅁㅁ
ㅁㅁㅁ <- 이렇게 가로로 3개를 2단으로 출력하고 싶습니다.
고수분들의 가르침 부탁드립니다.
소스
<table width="499" cellspacing="0" cellpadding="0" bgcolor="#323232" border="0">
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
$list[$i]['content']=eregi_replace(" "," ",$list[$i]['content']);
if($list[$i][file][0][file])
{
$file = "<img src='".$list[$i][file][0][path] .'/'. $list[$i][file][0][file]."' width=\"157\" height=\"130\" border=\"0\" align=\"center\">";
}
else
{
$file="";
}
?>
<td width="163" height="185" valign="top">
<table width="163" height="185" cellspacing="0" cellpadding="0" style="background:url(<?=$g4['path']?>/images/box_bg.png); background-repeat:no-repeat"">
<tr>
<td width="163" height="1" colspan="2"></td>
</tr>
<tr>
<td width="2" height="130"></td>
<td width="157" height="130">
<table width="157" height="130">
<tr>
<td colspan='2'>
<a href="<?=$list[$i]['href']?>"><?=$file?></a>
</td>
<td width="2" height="130"></td>
</tr>
<tr>
<td width="163" height="1" colspan="3"></td>
</tr>
<tr>
<td width="2" height="50"></td>
<td width="157" height="50"></td>
<td width="2" height="50"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<?
}
?>
<? if(!count($list))
{
?>
<td align=center height=30><font color=#6A6A6A>게시물이 없습니다.</a></td>
<?
}
?>
</tr>
</table>
댓글 전체
for문 아래 ?> 바로 위에 넣어보세요
if($i && $i % 3==0) echo "</tr><tr>";
if($i && $i % 3==0) echo "</tr><tr>";
아.. 이렇게 간단한것을.. 감사합니다~