background-image:url 이건 폴더를 만들어 폴더안에 이미지를 보여지게하는건데 이걸 갤러리게시판 리스트에 올라온걸 보이게 할려고하는데 에러가 뜨네요... 이 소스 자체가 리스트에있는건 불러오게할수없는건가요?
$path = "./image";
<div class="swiper-slide" style="background-image:url(./image/<?=$img?>)"></div>
foreach($entrys as $img){
<div class="swiper-slide" style="background-image:url(<?php echo latest("basic", "trendbook", 1000, 25) ?>)"></div>
최근걸 보여주는걸로 해봤는데.. 이것도 에러뜨네요..
<? $path = " http://1111.co.kr/board/bbs/board.php?bo_table=trendbook"; $entrys = array(); $dirs = dir($path); while(false !== ($entry = $dirs->read())){ if(($entry != '.') && ($entry != '..')) { if(!is_dir($path.'/'.$entry)) { $entrys[] = $entry; } } } $dirs->close(); ?> <!-- Add Arrows --><div class="swiper-button-next swiper-button-white"></div> <div class="swiper-button-prev swiper-button-white"></div> <div class="swiper-container gallery-thumbs"> <div class="swiper-wrapper"> <? foreach($entrys as $echo "http://1111.co.kr/board/bbs/board.php?bo_table=trendbook"){ ?> <div class="swiper-slide" style="background-image:url( http://1111.co.kr/board/bbs/board.php?bo_table=trendbook)"></div><? } ?> </div></div> <script> var galleryTop = new Swiper('.gallery-top', { nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', spaceBetween: 10, loop:true, loopedSlides: 5, //looped slides should be the same }); var galleryThumbs = new Swiper('.gallery-thumbs', { spaceBetween: 10, slidesPerView: 4, touchRatio: 0.2, loop:true, loopedSlides: 5, //looped slides should be the same slideToClickedSlide: true }); galleryTop.params.control = galleryThumbs; galleryThumbs.params.control = galleryTop; </script>
답변 2개 / 댓글 2개
폴더 경로가 맞지않아서 나오는 에러 입니다
답변글은 root에 소스가 있을때 예제 입니다
화일 위치에 따라 경로를 맞게 넣어야 합니다
그누보드 상에서 사용이라면 그냥 아래처럼 해주면 됩니다
$path=G5_DATA_PATH."/file/find";
1. 4번행 처럼 사이트 주소로는 6번, 8번행 같은 함수가 작동하지않습니다
2. path는 이미지가 저장되는 폴더명을 사용해야지 저렇게 게시판 링크를 넣어서는 안됩니다
그누보드 게시판 이미지 저장 위치를 아래와 같은 방법으로 경로를 넣어줍니다
$path="./data/file/게시판아이디";
3. 22행 foreach 문은 완전 엉터리 입니다
foreach($entrys as $vv){
?>
<div class="swiper-slide" style="background-image:url(<?=$path?>/<?=$vv?>);"></div>
답변에 대한 댓글 1개
find 이라는 폴더안에 index.php파일이 들어있던데 이것때문인가요?
Dir은...
$path="./data/file/find";
$entrys = array();
$dirs = dir($path);
while(false !== ($entry = $dirs->read())){
if(($entry != '.') && ($entry != '..')) {
if(!is_dir($path.'/'.$entry)) {
$entrys[] = $entry;
}
}
}
$dirs->close();
?>
<!-- Add Arrows -->
<div class="swiper-button-next swiper-button-white"></div>
<div class="swiper-button-prev swiper-button-white"></div>
<div class="swiper-container gallery-thumbs">
<div class="swiper-wrapper">
<?
foreach($entrys as $vv){
?>
<div class="swiper-slide" style="background-image:url(<?=$path?>/<?=$vv?>);"></div>
<?
}
?>
</div>
</div>
Warning: dir(./data/file/find) [function.dir]: failed to open dir: No such file or directory in /home/tnhands/public_html/index.php on line 288
Fatal error: Call to a member function read() on a non-object in /home/tnhands/public_html/index.php on line 289
답변을 작성하려면 로그인이 필요합니다.