그누보드 리스트 페이지에서 첨부파일 유무로 썸네일 출력

그누보드 리스트 페이지에서 첨부파일 유무로 썸네일 출력

QA

그누보드 리스트 페이지에서 첨부파일 유무로 썸네일 출력

답변 2

본문

안녕하세요 그누보드 초보라 소스를 이것저것 넣어 봐도 적용이 안 돼서 문의드립니다 ㅠㅠ

제가 해당 스킨에서 첨부파일 필드를 2개 쓰고 있는데, 리스트 페이지에서 첨부파일 1번 유무로 썸네일 설정을 하고 싶습니다!

 

첨부파일 1번에 이미지가 들어 있을 때 --- 1번 파일 이미지 썸네일 출력

첨부파일 1번에 이미지가 없을 때 --- 지정한 no-img.jpg 썸네일 출력

 

이렇게 만들고 싶어서 소스를 이렇게저렇게 넣은 결과

잘 작동되... 는 줄 알았는데

첨부파일 1번에 이미지가 없고 2번에 있을 때 2번 썸네일이 출력되게 됩니다 ㅠㅠ

2번 필드의 유무에 관계없이 무조건 1번! 필드로만 썸네일을 출력할 수 있을까요?

 

고수분들 답변 부탁드립니다 ㅠㅠ

 

현재 해당 부분 코드는 이렇습니다


<?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']) {
                                $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
                            } else {
                                $img_content = '<img src="../images/common/no-img.jpg">';
                            }
                            echo $img_content;
                        }
                         ?> 

이 질문에 댓글 쓰기 :

답변 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($thumb['src']&&$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;
                        }
                         ?> 

<?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로 보이고 있습니다 ㅠㅠ

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 119
© SIRSOFT
현재 페이지 제일 처음으로