그누보드 리스트 페이지에서 첨부파일 유무로 썸네일 출력 채택완료
안녕하세요 그누보드 초보라 소스를 이것저것 넣어 봐도 적용이 안 돼서 문의드립니다 ㅠㅠ
제가 해당 스킨에서 첨부파일 필드를 2개 쓰고 있는데, 리스트 페이지에서 첨부파일 1번 유무로 썸네일 설정을 하고 싶습니다!
첨부파일 1번에 이미지가 들어 있을 때 --- 1번 파일 이미지 썸네일 출력
첨부파일 1번에 이미지가 없을 때 --- 지정한 no-img.jpg 썸네일 출력
이렇게 만들고 싶어서 소스를 이렇게저렇게 넣은 결과
잘 작동되... 는 줄 알았는데
첨부파일 1번에 이미지가 없고 2번에 있을 때 2번 썸네일이 출력되게 됩니다 ㅠㅠ
2번 필드의 유무에 관계없이 무조건 1번! 필드로만 썸네일을 출력할 수 있을까요?
고수분들 답변 부탁드립니다 ㅠㅠ
현재 해당 부분 코드는 이렇습니다
</p>
<p><?php
if ($list[$i]['is_notice']) { // 공지사항 ?>
<span class="is_notice" style="<?php echo $line_height_style; ?>">공지</span>
<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);</p>
<p> if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
} else {
$img_content = '<img src="../images/common/no-img.jpg">';
}</p>
<p> echo $img_content;
}
?> </p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
2년 전
</p>
<p><?php
if ($list[$i]['is_notice']) { // 공지사항 ?>
<span class="is_notice" style="<?php echo $line_height_style; ?>">공지</span>
<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
if($thumb['src']&&<code>$list[$i]['file'][0]['file']</code>) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
} else {
$img_content = '<img src="../images/common/no-img.jpg">';
}
echo $img_content;
}
?>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 6개
�
2년 전
�
2년 전
잘 되는데.. 아래처럼 수정해 보세요.
if($thumb['src']&&$list[$i]['file'][0]['file']) {
=>
if($list[$i]['file'][0]['file']) {
if($thumb['src']&&$list[$i]['file'][0]['file']) {
=>
if($list[$i]['file'][0]['file']) {
�
2년 전
<?php
if ($list[$i]['is_notice']) { // 공지사항 ?>
<span class="is_notice" style="<?php echo $line_height_style; ?>">공지</span>
<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
if($list[$i]['file'][0]['file']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
} else {
$img_content = '<img src="../images/common/no-img.jpg">';
}
echo $img_content;
}
?>
이렇게 넣었는데도 여전히 첫번째 필드에 사진이 있는 것도 no-img로 보이고 있습니다 ㅠㅠ
if ($list[$i]['is_notice']) { // 공지사항 ?>
<span class="is_notice" style="<?php echo $line_height_style; ?>">공지</span>
<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
if($list[$i]['file'][0]['file']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
} else {
$img_content = '<img src="../images/common/no-img.jpg">';
}
echo $img_content;
}
?>
이렇게 넣었는데도 여전히 첫번째 필드에 사진이 있는 것도 no-img로 보이고 있습니다 ㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
2년 전
$thumb = ~~ 윗줄에 넣으세요
$thumb['src'] = '';
If( $list[0]['file'][0]['file"])
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
채택
답변대기
답변대기
답변대기
답변대기
채택
채택
답변대기
답변대기
답변대기
채택
코드 바꿔서 넣었더니 모든 이미지가 else에 있는 no-img.jpg로 변경됐어요