채택완료

최신글 이미지 없을때 출력 안하려면

2014-03-26 (수) 17:43:53 6,181
최신글에 첨부된 이미지가 없을때에는 출력 안되게 하려면
 
어떻게 수정하면 되나요??
 
 
 
Copy
<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개 / 댓글 1개

채택된 답변
+20 포인트
그러면 질문이 잘못 됬네요 저 부분이 아닌 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;

답변에 대한 댓글 1개

그부분만 수정하면.. 이미지 파일은 사라지는데.. 제목이 남아있어요??

이미지가 없으면 제목과 함께 나오지 않게 하려구요,.

답변을 작성하려면 로그인이 필요합니다.