더보기 버튼 적용후 필드명 반복표시 되는 문제

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
더보기 버튼 적용후 필드명 반복표시 되는 문제

QA

더보기 버튼 적용후 필드명 반복표시 되는 문제

본문

페이징을 없애고 [더보기] 버튼으로 대체하는 팁을 적용하였는데요.

아래 그림과 같이 최상단에 있는 필드명이 반복해서 표시가 되는데요.

맨윗줄에 있는 필드명은 한번만표시되고 [더보기]를 누르면 그 아래로 게시물수만 계속

늘어나게 하려면 어떻게 수정해야 할까요?

 

그림아래 [더보기] 부분의 소스를 함께 올립니다.

도움 부탁 드려요.

 

237008971_1557476498.3572.png

 

#[더보기]부분 소스

 

<div id="ajax_data"> 
        <table>
        <tr>
            <?php if ($is_checkbox) { ?>
            <th scope="col">
                <label for="chkall" class="sound_only">현재 페이지 게시물 전체</label>
                <input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
            </th>
            <?php } ?>
            <th scope="col">번호</th>
            <th scope="col">학생이름</th>
            <th scope="col">학교</th>
            <th scope="col">연락처</th>
            <th scope="col">연락처(집)</th>

            <th scope="col"><?php echo subject_sort_link('wr_datetime', $qstr2, 1) ?>날짜  <i class="fa fa-sort" aria-hidden="true"></i></a></th>
        </tr>            
        <?php
        for ($i=0; $i<count($list); $i++) {
         ?>        
        <tr class="<?php if ($list[$i]['is_notice']) echo "bo_notice"; ?>">
            <?php if ($is_checkbox) { ?>
            <td class="td_chk">
                <label for="chk_wr_id_<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['subject'] ?></label>
                <input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>">
            </td>
            <?php } ?>
            <td class="td_num2">
            <?php
            if ($list[$i]['is_notice']) // 공지사항
                echo '<strong class="notice_icon"><i class="fa fa-bullhorn" aria-hidden="true"></i><span class="sound_only">공지</span></strong>';
            else if ($wr_id == $list[$i]['wr_id'])
                echo "<span class=\"bo_current\">열람중</span>";
            else
                echo $list[$i]['num'];
             ?>
            </td>

            <td class="td_subject" style="padding-left:<?php echo $list[$i]['reply'] ? (strlen($list[$i]['wr_reply'])*10) : '0'; ?>px">
                <?php
                if ($is_category && $list[$i]['ca_name']) {
                 ?>
                <a href="<?php echo $list[$i]['ca_name_href'] ?>" class="bo_cate_link"><?php echo $list[$i]['ca_name'] ?></a>
                <?php } ?>
                <div class="bo_tit">
                   
                    <a href="<?php echo $list[$i]['href'] ?>">
                        <?php echo $list[$i]['icon_reply'] ?>
                        <?php
                            if (isset($list[$i]['icon_secret'])) echo rtrim($list[$i]['icon_secret']);
                         ?>
                        <?php echo $list[$i]['subject']; if($wr_10 != "") echo "(".$list[$i]['wr_10'].")";?>
                      
                    </a>
                    <?php
                    // if ($list[$i]['file']['count']) { echo '<'.$list[$i]['file']['count'].'>'; }
                    if (isset($list[$i]['icon_file'])) echo rtrim($list[$i]['icon_file']);
                    if (isset($list[$i]['icon_link'])) echo rtrim($list[$i]['icon_link']);
                    if (isset($list[$i]['icon_new'])) echo rtrim($list[$i]['icon_new']);
                    if (isset($list[$i]['icon_hot'])) echo rtrim($list[$i]['icon_hot']);
                    ?>
                    <?php if ($list[$i]['comment_cnt']) { ?><span class="sound_only">댓글</span><span class="cnt_cmt">+ <?php echo $list[$i]['wr_comment']; ?></span><span class="sound_only">개</span><?php } ?>
                </div>

            </td>
            <td class="td_group"><?php echo $list[$i]['wr_3'] ?></td>
            <td class="td_nick"><?php echo $list[$i]['wr_4'] ?></td>
            <td class="td_nick"><?php echo $list[$i]['wr_5'] ?></td>
            <td class="td_datetime"><?php echo $list[$i]['datetime2'] ?></td>

        </tr>       
        <?php } ?>
        <?php //if (count($list) == 0) { echo '<tr><td colspan="'.$colspan.'" class="empty_table">게시물이 없습니다.</td></tr>'; } ?>
        </tbody>
        </table>
 </div>

 

이 질문에 댓글 쓰기 :

답변 3

list.skin.php 에서 ajax_data 에 더보기로 가져온 html 을 append 하는 방식이라면


list.skin.php
<div> 
    <table>
        <thead>
        <tr>
            <?php if ($is_checkbox) { ?>
            <th scope="col">
            <label for="chkall" class="sound_only">현재 페이지 게시물 전체</label>
            <input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
            </th>
            <?php } ?>
            <th scope="col">번호</th>
            .....
        </tr>
        </thead>
        <tbody id="ajax_data">
            ...
        </tbody>
     </table>
</div>
ajax.php
보여주신 소스부분에서 for 문 밖의 부분들은 모두 삭제
<?php
for ($i=0; $i<count($list); $i++) {
 ?>        
.....
<?php }>
 

해당 내용만 보면

 

        <tr>
            <?php if ($is_checkbox) { ?>
            <th scope="col">
                <label for="chkall" class="sound_only">현재 페이지 게시물 전체</label>
                <input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
            </th>
            <?php } ?>
            <th scope="col">번호</th>
            <th scope="col">학생이름</th>
            <th scope="col">학교</th>
            <th scope="col">연락처</th>
            <th scope="col">연락처(집)</th>

            <th scope="col"><?php echo subject_sort_link('wr_datetime', $qstr2, 1) ?>날짜  <i class="fa fa-sort" aria-hidden="true"></i></a></th>
        </tr>            

 

부분을 지우셔야 합니다

더보기시 ajax_data가 호출 되기 때문에 <div id="ajax_data">를 필드명 아래로 넣어주세요.

답변을 작성하시기 전에 로그인 해주세요.
전체 23
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT