혼자서 해보려고 해봐도 도저히 어디서부터 어떻게 해야할지몰라
다시한번 도움요청드려요..!
이번계기로 큰도움이 될거같아요..
뷰페이지에서 파일첨부 이미지를 뷰페이지 상단에 슬라이드 방식인데요~!
업로드한 사진은 정상적으로 슬라이드되지만
업로드한적없는 노 이미지한장이 계속 생기네요
2장이든 3장이든 마지막에 노이미지 한장이 추가되어 생성되는건
어떻게 없애야할까요..
자꾸 문의드려죄송해요..! 이번건 공부하면 자제하도록 할게요 ~
<div class="w3-content w3-display-container" style="max-width:800px"> <?phpfor($i=0;$i<count($view[file]);$i++){?><img class="mySlides" src="<?php echo G5_DATA_URL.'/file/'.$bo_table.'/'.urlencode($view[file][$i][file]); ?>" /><?php}?> <div class="w3-center w3-container w3-section w3-large w3-text-white w3-display-bottommiddle" style="width:100%"> <div class="w3-left w3-hover-text-khaki" onclick="plusDivs(-1)">❮</div> <div class="w3-right w3-hover-text-khaki" onclick="plusDivs(1)">❯</div> <?phpfor($i=0;$i<count($view[file]);$i++){?><span class="w3-badge demo w3-border w3-transparent w3-hover-white" onclick="currentDiv(<?=$i+1?>)"></span><?php}?> </div></div> <script>var slideIndex = 1;showDivs(slideIndex); function plusDivs(n) { showDivs(slideIndex += n);} function currentDiv(n) { showDivs(slideIndex = n);} function showDivs(n) { var i; var x = document.getElementsByClassName("mySlides"); var dots = document.getElementsByClassName("demo"); if (n > x.length) {slideIndex = 1} if (n < 1) {slideIndex = x.length} for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" w3-white", ""); } x[slideIndex-1].style.display = "block"; dots[slideIndex-1].className += " w3-white";}</script>
답변 1개 / 댓글 1개
count($view[file]); <---이것은 첨부 이미지 갯수보다 1 많습니다
view[file][count] 라는 배열이 하나더 있기 때문입니다
count($view[file])-1 하거나 view[file][count] 를 사용하면 됩니다
2개 업로드했는데 왜 3개가 나올까? 이런 의문은
print_r($view[file]) 해보면 왜 그런 상황이 되는지 금방 판단할 수 있을것입니다
그누보드를 완전히 파악하는데도 도움이 될 것이고....
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.
혹시 홈페이지 있으신가요
교육홈페이지있다면 결제해서 공부하고싶네요..