| 제목 | ci 3.0 pagination fixed num_links | ||
|---|---|---|---|
| 글쓴이 | darkninja | 작성시각 | 2014/06/16 19:26:31 | 
| 
                         | 
                |||
| 
                        약간 다른 페이지네이션입니다. 계산하는 부분은 어느분의 블로그에서 얻어왔습니다. http://naiyumie.tistory.com/320 부트스트랩용입니다. 실력이 초짜일때 만든거라 허접 ㅋ 두번째 파일을 다운 받으시고 댓글에 있는 부분을 수정하셔야 오류가 없습니다.  | 
                |||
| 첨부파일 | 
                                my-pagination-ci3-bootstrap.zip (15.4 KB) my-pagination-new.zip (17.6 KB)  | 
                    ||
| 다음글 | 한국형 게시판에 사용되는 페이지네이션을 구현한 라이브러... (4) | ||
| 이전글 | 커스텀 페이지네이션 라이브러리 (9) | ||
| 
                             
                                한대승(불의회상)
                                /
                                2014/06/17 09:24:07 /
                                추천
                                0
                             
                             | 
                    
| 
                             
                                양승현
                                /
                                2014/07/07 15:20:40 /
                                추천
                                0
                             
                            
                                좋은정보 감사합니다. 
                        해당 블로그분 아는분이네요. 나이유미님 저희 회사에서 잠깐 계셨던 분.. 참 개발 잘하시고, 항상 노력하시는 분..  | 
                    
| 
                             
                                darkninja
                                /
                                2014/08/12 18:08:55 /
                                추천
                                0
                             
                            
                                my-pagination-new.zip 
                        10개 단위로 링크가 표시되지 않아서 수정한 파일을 올립니다. ci 2.2, 3.0에서 app libraries 에 복사하시면 사용할수 있습니다. 오류가 있으면 알려주세요! 
  // Calculate the start and end numbers. These determine
  // which number to start and end the digit links with.
  if  ($this->cur_page > $this->num_links_prev) {
            $start = $this->cur_page - $this->num_links_prev;
  } else { 
   $start = 1;
  } 
  if  (($this->cur_page + $this->num_links_next) < $num_pages) {
   $end = $this->cur_page + $this->num_links_next;
  } else { 
   $end = $num_pages;
  } 
  //Re Calculate the start and end numbers. 
  //For fixed num links!
  $tend = $start + $this->num_links;
  if  ($tend > $num_pages) {
   $start = $num_pages - $this->num_links;
   if ($start < 1) {
    $start = 1;
   }
  } 
  if  ($end < $tend && $tend <= $num_pages) {
   $end = $tend;
  } 
  if ($start > $end) {
   $start = $end;
  }
                             | 
                    
| 
                             
                                darkninja
                                /
                                2014/08/26 21:11:53 /
                                추천
                                0
                             
                            
                                $this->CI->load->language('pagination'); 
                        여기에서 ci 2.2 에서 오류날건데 ci 3.0 dev 에 있는 pagination_lang.php 를 복사해 주시면 됩니다. 관련 코드를 삭제해도 되겠죠. $end 계산하는 부분 오류가 있어서 수정합니다. 
    // Calculate the start and end numbers. These determine
    // which number to start and end the digit links with.
    if ($this->cur_page > $this->num_links_prev) {
      $start = $this->cur_page - $this->num_links_prev;
    } else { 
      $start = 1;
    } 
    if (($this->cur_page + $this->num_links_next) < $num_pages) {
      $end = $this->cur_page + $this->num_links_next;
      if ($num_pages <= ($this->num_links + 1)) { // num_pages < num_links + 1
        $end = $num_pages;
      } 
    } else { 
      $end = $num_pages;
    } 
    //Re Calculate the start and end numbers. 
    //For fixed num links!
    $tend = $start + $this->num_links; // start + num_links != cur_page + num_links_next;
    if ($tend > $num_pages) { 
      $start = $num_pages - $this->num_links;
      if ($start < 1) {
        $start = 1;
      }
    } 
    if ($end < $tend && $tend <= $num_pages) {
      $end = $tend;
    } 
    if ($start > $end) {
      $start = $end;
    }
                             | 
                    
좋은 자료 감사 합니다.