CI 묻고 답하기

제목 고정형 My_pagination(ci 3.0) 적용시 오류
글쓴이 elnino 작성시각 2016/03/29 18:35:32
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 15727   RSS

현재 슘님의 고정형 커스텀 My_pagination을 적용시켜 작업을 하고 있는데 

모양은 아래와 같습니다.

<< < 1  2  3  4  > >>

근데  마지막으로 가서 다음버튼을 누르면 마지막 페이지가 계속 나와야되는데 

만약 72가 끝이면 per_page가 8로설정했을때  80이랑 88까지 넘어갑니다.

72에서 멈춰야하는데 넘어가버립니다.

 

컨트롤러에서 저의 설정

        //페이지네이션 라이브러리 로딩 추가
        $this->load->library('pagination');
        //페이지네이션 설정
        $config['display_always'] = TRUE;      
        $config['use_fixed_page'] = TRUE;
        $config['fixed_page_num'] = 4;
        $config['display_first_always'] = TRUE;
        $config['display_last_always'] = TRUE;
        $config['display_prev_always'] = TRUE;
        $config['display_next_always'] = TRUE;
        $config['base_url']= '/magazine/lists/magazines'.$page_url.'/page/'; // 페이징 주소
        $config['total_rows']= $this->magazine_m->get_sns_list($this->uri->segment(3),'count', '', '', $search_word); // 게시물의 전체 개수
        $config['per_page']= 8; // 한 페이지에 표시할 게시물 수
        $config['uri_segment']= $uri_segment; // 페이지 번호가 위치한 세그먼트
        $config['next_link'] = '>';
        $config['prev_link'] = '<';
        $config['first_link'] = '«';
        $config['last_link'] = '»';
        $config['anchor_class'] = 'class="last"';

 

 

my_pagination

		// Render the "next" link
		if ($this->next_link !== FALSE)
		{
			if ($this->display_next_always === TRUE AND $this->disable_next_link === TRUE AND $this->cur_page == $num_pages)
			{
				$output .= $this->disabled_next_tag_open.$this->next_link.$this->disabled_next_tag_close;
			}
			else if ($this->display_next_always === TRUE OR $this->cur_page != $num_pages)
			{
				$i = ($this->use_page_numbers) ? (($this->cur_page == $num_pages)? $num_pages : $this->cur_page + 1) : $this->cur_page * $this->per_page;

				$attributes = sprintf('%s %s="%d"', $this->_attributes, $this->data_page_attr, (int) $i);

				$output .= $this->next_tag_open.'<a href="'.$base_url.$this->prefix.$i.$this->suffix.'"'.$attributes
					.$this->_attr_rel('next').'>'.$this->next_link.'</a>'.$this->next_tag_close;
			}
		}

 

제생각에는 my_pagination에서 변경을 해야될것같은데 힌트좀 주시면 감사하겠습니다.

 다음글 csrf 사용시 ajax를 한번이 아닌 여러번 호출할시... (4)
 이전글 쿼리가 제대로 작동이 안되요.. (1)

댓글

/ 2016/03/30 09:22:38 / 추천 0

@elnino

슘님꺼 어떻게 되어있는지 안봐서 모르겠는데, 콘피그의 토탈로우가 잘못됬던가, My_Pagination.php -> create_links() 메소드가 잘못됬던가일 것 같은데요..

해행행 / 2016/03/30 21:04:21 / 추천 0

저도 슘님꺼는 보질못했지만 쓰신글로 유추해보아서 저도 그쪽의문제는 토탈로우값이 잘못되었던경우가 많더군요

실제디비에서 토탈로우값 직접쿼리짜셔서 들고오셔서 한번해보시죠