부트스트랩 5.XX

페이지 get_paging() 부트스트랩 5.x 버전 변경 내

profile_image 관리자 작성   (116.♡.19.41)
0건
1,377회
23-08-25 20:17


./lib/commob.lib.php 파일을 열고 

23번째 줄 

1. get_paging() 함수를 아래와 같이 바꾸시면 됩니다. 

※ 기존꺼는 주석처리 하세요. 주석처리는 

/* 내용 */ 이렇게 하시면 됩니다. 잘못되었을 경우 삽입한 코드를 지우시고 주석처리 부분만 원래 대로 돌려주시면 됩니다. 


 function get_paging($write_pages, $cur_page, $total_page, $url, $add="")

{

    //$url = preg_replace('#&page=[0-9]*(&page=)$#', '$1', $url);

    $url = preg_replace('#(&)?page=[0-9]*#', '', $url);

$url .= substr($url, -1) === '?' ? 'page=' : '&page=';


    $str = '';

    if ($cur_page > 1) {

        //$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start">처음</a>'.PHP_EOL;

$str .= '<li class="page-item"><a class="page-link" href="'.$url.'1'.$add.'" aria-label="start"><i class="bi bi-chevron-double-left"></i><span aria-hidden="true"> 처음</span></a></li>'.PHP_EOL;

    }


    $start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;

    $end_page = $start_page + $write_pages - 1;


    if ($end_page >= $total_page) $end_page = $total_page;


    if ($start_page > 1) $str .= '<li class="page-item"><a class="page-link" href="'.$url.($start_page-1).$add.'" aria-label="Previous"><i class="bi bi-chevron-left"></i> <span aria-hidden="true">이전</span></a></li>'.PHP_EOL;

//$str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev">이전</a>'.PHP_EOL;


    if ($total_page > 1) {

        for ($k=$start_page;$k<=$end_page;$k++) {

            if ($cur_page != $k)

               // $str .= '<a href="'.$url.$k.$add.'" class="pg_page">'.$k.'<span class="sound_only">페이지</span></a>'.PHP_EOL;

$str .= '<li class="page-item"><a class="page-link" href="'.$url.$k.$add.'">'.$k.'</a></li>'.PHP_EOL;

            else

              //  $str .= '<span class="sound_only">열린</span><strong class="pg_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;

     $str .= '<li class="page-item active" aria-current="page"><a class="page-link" href="#">'.$k.'</a></li>'.PHP_EOL;

        }

    }


    if ($total_page > $end_page) $str .= '<li class="page-item"><a class="page-link" href="'.$url.($end_page+1).$add.'" aria-label="Next"><span aria-hidden="true">다음</span> <i class="bi bi-chevron-right"></i></a></li>'.PHP_EOL;

//$str .= '<a href="'.$url.($end_page+1).$add.'" class="pg_page pg_next">다음</a>'.PHP_EOL;


    if ($cur_page < $total_page) {

        // $str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end">맨끝</a>'.PHP_EOL;

$str .= '<li class="page-item"><a class="page-link" href="'.$url.$total_page.$add.'" aria-label="start"><span aria-hidden="true">맨끝</span> <i class="bi bi-chevron-double-right"></i></a></li>'.PHP_EOL;

    }


    if ($str)

        return "<nav aria-label=\"Page navigation\"><ul class=\"pagination\">{$str}</ul></nav>";

    else

        return "";

}



  댓글(0)