채택완료
이미지를 등록하지 않은 것은 나오지 않게하려면 ....
아래의 소스로 최신이미지를 불러드리고 있습니다
<div class="latest-block"><?=mw_latest_rand("tablegal", "car", 16, 100, 1, $mw[config][cf_index_cache])?></div>
이미지가 없는 것은 no image로 나오는데,
이미지를 등록하지 않은 것은 나오지 않게하려면
어떻게 해야하나요.
감사합니다.
이래는 tablegal 소스입니다.
----------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<?
//스킨제작자
//=========================================
//=========================================
//사용자가 설정하는 부분입니다!! 이부분만 수정하셔요!!
//=========================================
$cols=8; // 이미지 가로갯수
$imgwidth=75; //표시할 이미지의 가로사이즈
$imgheight=85; //표시할 이미지의 세로사이즈
//=========================================
?>
<table width=100% border=0 cellpadding='0' cellspacing='0' align='center'>
<tr><td colspan=<?=$cols;?> height=10></td></tr>
<tr>
<td colspan=<?=$cols;?> height=20 align=left>
<a href='<?=$g4[path]?>/car/board.php?bo_table=<?=$bo_table?>'><span style='color:gray; font-weight:bold'>자동차</span></a>
</td>
</tr>
<tr><td colspan=<?=$cols?> height=10></td></tr>
<?
for ($i=0; $i<count($list); $i++)
{
if($i % $cols == 0 || $i==0){echo "<tr>";} //테이블 열바꿈 관련
$title = get_text($list[$i][wr_subject]);
$content = cut_str(get_text($list[$i][wr_content]), 80);
$img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
$href = "$g4[path]/car/board.php?bo_table=$bo_table";
//이미지 없을때 표시할 이미지 설정
if (!file_exists($img) || !$list[$i][file][0][file])$img = "$latest_skin_path/img/noimage.gif";
echo <<<HEREDOC
<td valign='top' align='center'>
<table width="100%" border='0' cellpadding='3' cellspacing='0' align='center' style="margin: 0px; padding: 0px;background-color:#EEF3E7;">
<tr>
<td align='center'>
<a href='$g4[path]/car/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'><img src='{$img}' width='{$imgwidth}' height='{$imgheight}' border='0' align='absmiddle' title='$title'></a>
</td>
</tr>
<tr>
<td align='center'><a href='$g4[path]/car/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'>
<span style="font-size:11px"><b>{$list[$i][wr_32]}{$list[$i][wr_33]}</b></span></font>
<br>
{$list[$i][wr_20]} {$list[$i][wr_21]}
</a></td>
</tr>
</table>
</td>
HEREDOC;
if($i%$cols == ($cols-1)&& $i>0){ echo "</tr>";} //테이블 열바꿈 관련
}
?>
</tr>
<tr><td colspan=<?=$cols;?> height=10></td></tr>
</table>
<? if (count($list) == 0) { ?><br><center>등록된 게시물이 없습니다.</center><br><? } ?>
|
답변 5개
채택된 답변
+20 포인트
이렇게하면 되겠네요
if (!file_exists($img) || !$list[$i][file][0][file])$img = "$latest_skin_path/img/noimage.gif";
<-- 수정
if (!file_exists($img) || !$list[$i][file][0][file])$img = "";
이미지 출력부분
<?if($img){?>
<tr>
<td align='center'>
<a href='$g4[path]/car/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'><img src='{$img}' width='{$imgwidth}' height='{$imgheight}' border='0' align='absmiddle' title='$title'></a>
</td>
</tr>
<?}?>
테스트는 안해봤지만 한번 응용해서 해보세요
Copy
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<?
//스킨제작자
//=========================================
//[email protected]
//http://www.soccerdb.co.kr
//=========================================
//사용자가 설정하는 부분입니다!! 이부분만 수정하셔요!!
//=========================================
$cols=8; // 이미지 가로갯수
$imgwidth=75; //표시할 이미지의 가로사이즈
$imgheight=85; //표시할 이미지의 세로사이즈
//=========================================
?>
<table width=100% border=0 cellpadding='0' cellspacing='0' align='center'>
<tr><td colspan=<?=$cols;?> height=10></td></tr>
<tr>
<td colspan=<?=$cols;?> height=20 align=left>
<a href='<?=$g4[path]?>/car/board.php?bo_table=<?=$bo_table?>'><span style='color:gray; font-weight:bold'>자동차</span></a>
</td>
</tr>
<tr><td colspan=<?=$cols?> height=10></td></tr>
<?
for ($i=0; $i<count($list); $i++)
{
if($i % $cols == 0 || $i==0){echo "<tr>";} //테이블 열바꿈 관련
$title = get_text($list[$i][wr_subject]);
$content = cut_str(get_text($list[$i][wr_content]), 80);
$img = "img width='$imgwidth' height='$imgheight' border='0' align='absmiddle' title='$title' src=$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
$href = "$g4[path]/car/board.php?bo_table=$bo_table";
//이미지 없을때 표시할 이미지 설정
if (!file_exists($img) || !$list[$i][file][0][file])$img = "!-- no image --";
echo <<<HEREDOC
<td valign='top' align='center'>
<table width="100%" border='0' cellpadding='3' cellspacing='0' align='center' style="margin: 0px; padding: 0px;background-color:#EEF3E7;">
<tr>
<td align='center'>
<a href='$g4[path]/car/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'><{$img}></a>
</td>
</tr>
<tr>
<td align='center'><a href='$g4[path]/car/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'>
<span style="font-size:11px"><b>{$list[$i][wr_32]}{$list[$i][wr_33]}</b></span></font>
<br>
{$list[$i][wr_20]} {$list[$i][wr_21]}
</a></td>
</tr>
</table>
</td>
HEREDOC;
if($i%$cols == ($cols-1)&& $i>0){ echo "</tr>";} //테이블 열바꿈 관련
}
?>
</tr>
<tr><td colspan=<?=$cols;?> height=10></td></tr>
</table>
<? if (count($list) == 0) { ?><br><center>등록된 게시물이 없습니다.</center><br><? } ?>
답변을 작성하려면 로그인이 필요합니다.