카테고리 없음

[그누보드] 커스텀 슬라이더 만들기 (게시물의 첨부파일 갯수대로 이미지 출력)

경호! 2022. 1. 19. 09:47
                  <?php

                    // 첨부파일 이미지 갯수대로 출력
                    function get_list_attachimg($recent_table, $wr_id, $option=0)
                    {
                        $result = sql_query("select bf_file, bf_source from g5_board_file where bo_table='{$recent_table}' and wr_id={$wr_id} order by bf_no limit {$option}, 1");
                        $row = sql_fetch_array($result);
                        return $row['bf_file'];
                    }

                    $recent_table = 'slider';
                    $recent_table_fullname = 'g5_write_'.$recent_table;
                    $result = sql_query("select wr_id from {$recent_table_fullname} order by wr_datetime desc");

                    
                    for($i=0; $row=sql_fetch_array($result); $i++) {
                      
                      $img_src1 = get_list_attachimg($recent_table, $row['wr_id'], 0);
                      $img_src2 = get_list_attachimg($recent_table, $row['wr_id'], 1);
                      $img_src3 = get_list_attachimg($recent_table, $row['wr_id'], 2);
                      
                      echo '<div class="swiper-slide">';
                      echo '<div class="em-swiper-slide-left">';
                      echo "<img src='".G5_DATA_URL."/file/slider/".$img_src1."' alt='이미지' />";
                      echo '</div>';
                      echo '<div class="em-swiper-slide-right">';
                      echo '<div>';
                      echo "<img src='".G5_DATA_URL."/file/slider/".$img_src2."' alt='이미지' />";
                      echo '</div>';
                      echo '<div>';
                      echo "<img src='".G5_DATA_URL."/file/slider/".$img_src3."' alt='이미지' />";
                      echo '</div>';
                      echo '</div> ';
                      echo '</div>';

                    }

                ?>