테스트 사이트 - 개발 중인 베타 버전입니다

게시판 문의 드립니다.

· 12년 전 · 725 · 3
안녕하세요

사이트 홍보 게시판인데요

이미지가 없을 때 noimg이미지를 보여지게 하구싶은데요

어떻게 해야 할지 도무지 모르겟네요 ㅜㅜ

고수님들 도와주십시요

감사합니다.

아래는 list 스킨입니다.

<?
for ($i=0; $i<count($list); $i++) {
$bg = $i%2 ? 0 : 1;
?>

<tr class="bg<?=$bg?>">
<? if ($is_checkbox) { ?><td class="checkbox"><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"></td><? } ?>
<td class="num">
<a href=<?=$list[$i][wr_link1]?> target=_blank><img src="<?=$list[$i]['file'][0]['path']?>/<?=$list[$i]['file'][0]['file']?>" border=0></a>
</td>

<td class="subject" style=padding-left:15>
<?

if ($is_category && $list[$i][ca_name]) {
echo "<span class=small><font color=gray>[<a href='{$list[$i][ca_name_href]}'>{$list[$i][ca_name]}</a>]</font></span> ";
}

echo "<a href='{$list[$i][href]}'><font color=#2080D0><b>{$list[$i][subject]}</b></font></a>";


// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }

echo " " . $list[$i][icon_new];
echo " " . $list[$i][icon_hot];
echo " " . $list[$i][icon_secret];
echo $nobr_end;
?>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 3개

이미지가 없을 경우를 대비해 onerror 로 대체 이미지를 적어주면 될 것 같습니다.

jquery 등을 사용하여 onerror 를 사이트 전체이미지에 적용하시는 방법도 있고요~

테스트 URL : http://jsfiddle.net/qUpUH/
for문 다음줄에 추가
if($list[$i]['file'][0]['view']) $img=$list[$i]['file'][0]['path'] .'/'. $list[$i]['file'][0]['file'];
else $img='경로/noimg.gif';

이미지출력부분
<img src="<?=$img?>">
testers 님 균이님 답변 감사합니다.

저는 왕초보라 ㅜㅜ

알려주셔도 어떻게 해야 할지 모르겟네요 ㅜㅜ

답변 감사합니다.

게시글 목록

번호 제목
284348
284336
284333
284332
284320
284318
284316
284313
284307
284306
284303
284298
284296
284290
284286
284280
284277
284272
284261
284259