이미지를 등록하지 않은 것은 나오지 않게하려면 ....

이미지를 등록하지 않은 것은 나오지 않게하려면 ....

QA

이미지를 등록하지 않은 것은 나오지 않게하려면 ....

답변 5

본문

아래의 소스로 최신이미지를 불러드리고 있습니다 
<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

이렇게하면 되겠네요
    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> 
<?}?>

테스트는 안해봤지만 한번 응용해서 해보세요


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

<? 
//스킨제작자 
//========================================= 
//*** 개인정보보호를 위한 이메일주소 노출방지 *** 
//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><? } ?> 

WEBsiting님 죄송합니다만 적용이 안되네요.

균이님 것이 적용이 됩니다.
그런데, 아래 글씨부분이 나오고
아래 글씨나오는 것을 삭제하고 해보았는데
이미지가 들어가는 부분이 그대로 남아있네요.

이미지가 없으면 아래 글씨도 이미지 박스 부분도 안나오게 
하고 싶은데요. 정말 어렵네요.
감사합니다. 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 125,873
© SIRSOFT
현재 페이지 제일 처음으로