최신글 이미지 없을때 출력 안하려면
본문
최신글에 첨부된 이미지가 없을때에는 출력 안되게 하려면
어떻게 수정하면 되나요??
<div class="gall_img">
<a class="img_a" href="<?php echo $list[$i]['href'] ?>">
<?php
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $imgwidth, $imgheight);
if($thumb['src']) {
$img_content = '<img class="img_left" src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$imgwidth.'" height="'.$imgheight.'">';
} else {
$img_content = '<div class="no_img" style="width:'.$imgwidth.'px;height:'.$imgheight.'px">no image</div>';
}
echo $img_content;
?>
</a>
</div>
<div class="gall_text">
<?php
//echo $list[$i]['icon_reply']." ";
echo "<a href=\"".$list[$i]['href']."\">";
if ($list[$i]['is_notice'])
echo "<strong>".$list[$i]['subject']."</strong>";
else
echo $list[$i]['subject'];
if ($list[$i]['comment_cnt'])
echo $list[$i]['comment_cnt'];
echo "</a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
if (isset($list[$i]['icon_new'])) echo " " . $list[$i]['icon_new'];
if (isset($list[$i]['icon_hot'])) echo " " . $list[$i]['icon_hot'];
if (isset($list[$i]['icon_link'])) echo " " . $list[$i]['icon_link'];
if (isset($list[$i]['icon_secret'])) echo " " . $list[$i]['icon_secret'];
?>
</div>
답변 2
그러면 질문이 잘못 됬네요 저 부분이 아닌 for문 부분을 보여주셔야되요
<?php |
04 |
$thumb = get_list_thumbnail( $bo_table , $list [ $i ][ 'wr_id' ], $imgwidth , $imgheight ); |
05 |
if ( $thumb [ 'src' ]) { |
06 |
$img_content = '<img class="img_left" src="' . $thumb [ 'src' ]. '" alt="' . $thumb [ 'alt' ]. '" width="' . $imgwidth . '" height="' . $imgheight . '">' ; |
07 |
} else { |
08 |
$img_content = '<div class="no_img" style="width:' . $imgwidth . 'px;height:' . $imgheight . 'px">no image</div>' ; //이부분을 $img_content =''; 하면 안나오게 되겠죠? |
09 |
} |
10 |
echo $img_content ; |
답변을 작성하시기 전에 로그인 해주세요.