웹진형에서 이미지 없을 시, no image없애기
본문
아래 웹진형 스킨 사용중인데요.
첨부 이미지가 없을 경우에는, 이미지 부분을 없애고 싶은데 어디를 어떻게 손보면 되는지요.
현재는 이미지가 없으면 no image로 이미지 사이즈만큼 칸이 출력 되는데, 이걸 아에 이미지가 없으면
없애고 싶습니다.
아래 리스트 스킨입니다. 고수님들 잘 봐주십시오.
<ul id="gall_ul">
<?php for ($i=0; $i<count($list); $i++) {
/*
if($i>0 && ($i % $bo_gallery_cols == 0))
$style = 'clear:both;';
else
$style = '';
if ($i == 0) $k = 0;
$k += 1;
if ($k % $bo_gallery_cols == 0) $style .= "margin:0 !important;";
*/
?>
<li class="gall_li <?php if ($wr_id == $list[$i]['wr_id']) { ?>gall_now<?php } ?>">
<span class="sound_only">
<?php
if ($wr_id == $list[$i]['wr_id'])
echo "<span class=\"bo_current\">열람중</span>";
else
echo $list[$i]['num'];
?>
</span>
<ul class="gall_con"> <!-- 이미지 출력 -->
<li class="gall_href" style="padding:4px; border:1px solid #ddd;">
<a href="<?php echo $list[$i]['href'] ?>">
<?php
if ($list[$i]['is_notice']) { // 공지사항 ?>
<!-- strong style="width:<?php echo $board['bo_gallery_width'] ?>px;height:<?php echo $board['bo_gallery_height'] ?>px">공지</strong -->
<strong style="width:<?php echo $thumb_width ?>px;height:45px">공지</strong>
<?php } else {
// $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $thumb_width, $thumb_height); // 썸네일 크기를 위에서 선언한 크기사용
if($thumb['src']) {
// $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$thumb_width.'" height="'.$thumb_height.'">';
} else {
// $img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px">no image</span>';
$img_content = '<span style="width:'.$thumb_width.'px;height:'.$thumb_height.'px">no image</span>';
}
echo $img_content;
}
?>
</a>
</li>
</ul>
<ul class="gall_con2"> <!-- 제목,내용 출력 -->
<li class="gall_text_href">
<?php if ($is_checkbox) { ?>
<label for="chk_wr_id_<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['subject'] ?></label>
<input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>">
<?php } ?>
<a href="<?php echo $list[$i]['href'] ?>">
<?php echo $list[$i]['subject'] ?>
<?php if ($list[$i]['comment_cnt']) { ?><span class="sound_only">댓글</span><?php echo $list[$i]['comment_cnt']; ?><span class="sound_only">개</span><?php } ?>
</a>
<?php
// 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_file'])) echo $list[$i]['icon_file'];
//if (isset($list[$i]['icon_link'])) echo $list[$i]['icon_link'];
//if (isset($list[$i]['icon_secret'])) echo $list[$i]['icon_secret'];
?>
</li>
<li>
<?php
if ($list[$i]['is_notice']) // 공지사항
echo '<strong>공지</strong>';
else
echo "<span class='bo_num'>".$list[$i]['num']."</span>";
?>
<?php
if ($is_category && $list[$i]['ca_name'] && !$list[$i]['is_notice']) { // 공지사항은 분류출력 안함 ?>
<a href="<?php echo $list[$i]['ca_name_href'] ?>" class="bo_cate_link"><?php echo $list[$i]['ca_name'] ?></a> <span class="bo_gubun">|</span>
<?php } ?>
<?php echo $list[$i]['name'] ?> <span class="bo_gubun">|</span> <!-- 작성자 -->
<?php echo $list[$i]['datetime2'] ?> <span class="bo_gubun">|</span> <!-- 작성일 -->
<span class="gall_subject">조회 </span><?php echo $list[$i]['wr_hit'] ?>
<?php if ($is_good) { ?><span class="gall_subject">추천</span><strong><?php echo $list[$i]['wr_good'] ?></strong><?php } ?>
<?php if ($is_nogood) { ?><span class="gall_subject">비추천</span><strong><?php echo $list[$i]['wr_nogood'] ?></strong><?php } ?>
</li>
<?php
$wr_content = preg_replace("/<(.*?)\>/"," ",$list[$i][wr_content]);
$wr_content = preg_replace("/ /"," ",$wr_content);
$wr_content = str_replace("//##", " ", $wr_content);
$wr_content = cut_str(get_text($wr_content), 100, '…');
if (!$list[$i]['is_notice']) { // 공지사항이 아닐경우 내용출력 ?>
<li class="bo_content"><?php echo $wr_content?></li>
<?php } ?>
</ul>
</li>
<?php } ?>
<?php if (count($list) == 0) { echo "<li class=\"empty_list\">게시물이 없습니다.</li>"; } ?>
</ul>
<?php if ($list_href || $is_checkbox || $write_href) { ?>
<div class="bo_fx">
<?php if ($is_checkbox) { ?>
<ul class="btn_bo_adm">
<li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value"></li>
</ul>
<?php } ?>
<?php if ($list_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="btn_b01">목록</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</form>
</div>
답변 6
$img_content = '<span style="width:'.$thumb_width.'px;height:'.$thumb_height.'px">no image</span>';
이것도 아예 주석처리 해주시면 되지 않을까 싶네요.
//$img_content = '<span style="width:'.$thumb_width.'px;height:'.$thumb_height.'px">no image</span>';
skin/latest/jw_ga_la_01/img/noimg.gif
배경색이 흰색이라면 흰색의 이미지를 만들어 위 'noimg.gif'를 바꿔주면 됩니다.
121*91px
$img_content = '<span style="width:'.$thumb_width.'px;height:0px">no image</span>';
height:0px
로 바꾸던지...
//$img_content = '<span style="width:'.$thumb_width.'px;height:'.$thumb_height.'px">no image</span>';
$img_content = '';
이렇게 해보세요.
skin/board/gallery/list.skin.php
에서는...
'no image' 글자만 지워주면 되네요.
그런데 왜 저렇게 수정하신거지요?
이걸
$img_content = '<span style="width:'.$thumb_width.'px;height:0px">no image</span>';
아래처럼 하니간.
$img_content = '';
아래처럼 작은 네모칸이 생기네요.