| 제목 | 페이지네이션에서 뒤에 처리 | ||
|---|---|---|---|
| 카테고리 | CI 2, 3 | ||
| 글쓴이 | 람이 | 작성시각 | 2017/05/25 10:08:08 |
|
|
|||
|
페이징 처리시에 /admin/reserve_list/page/1/tourcode_new 이런 구조로 사용 중인데요... 페이지 번호 뒤에 나오는 segment 5번은 orderby 구절로 사용하려고 합니다.
1페이지 2페이지 3페이지 에서 2페이지를 누르면 /admin/reserve_list/page/1 이렇게 되어서 orderby 구절이 사라져서요...
//페이지 네이션
public function pagenation($method="", $table="", $where="", $rows_page="10", $uri_segment="4", $option="", $orderby="") {
global $msg;
if($method == "admin") {
$controll = "admin_member";
} else if($method == "ci_agent") {
$controll = "agent";
} else if($method == "ci_exchange") {
$controll = "exchange";
} else if($method == "member") {
$controll = "biz_member";
} else if($method == "hotel") {
$controll = "hotel_list";
} else if($method == "admin_notice") {
$controll = "admin_notice";
} else if($method == "ci_reserve") {
$controll = "reserve_list";
} else if($method == "report") {
$controll = "report";
}
$config['base_url'] = '/admin/'.$controll.'/page/'; //페이징 주소
$config['total_rows'] = $this->admin_m->getAll($method, "", $where); //게시물의 전체 갯수 getAll($table='', $id='', $option='')
$config['per_page'] = $rows_page; //한 페이지에 표시할 게시물 수
$config['uri_segment'] = $uri_segment; //페이지 번호가 위치한 세그먼트
$config['full_tag_open'] = '<ul class="pager">';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = '처음';
$config['first_tag_open'] = '<li style="margin-left:5px; margin-right:5px;">';
$config['first_tag_close'] = '</li>';
$config['last_link'] = '끝';
$config['last_tag_open'] = '<li style="margin-left:5px; margin-right:5px;">';
$config['last_tag_close'] = '</li>';
$config['next_link'] = '다음';
$config['next_tag_open'] = '<li style="margin-left:5px; margin-right:5px;">';
$config['next_tag_close'] = '</li>';
$config['prev_link'] = '이전';
$config['prev_tag_open'] = '<li style="margin-left:5px; margin-right:5px;">';
$config['prev_tag_close'] = '</li>';
$config['num_tag_open'] = '<li style="margin-left:5px; margin-right:5px;">';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li style="margin-left:5px; margin-right:5px;"><a style="color:#FFF; background:#ccc">';
$config['cur_tag_close'] = '</a></li>';
//페이지네이션 초기화
$this->pagination->initialize($config);
//페이징 링크를 생성하여 view에서 사용할 변수에 할당
$pages['msg'] = $msg;
$pages['pagination'] = $this->pagination->create_links();
//목록을 불러오기 위한 offset, limit 값 가져오기
$page = $this->uri->segment($uri_segment, 1);
if ($page > 1) {
$start = (($page/$config['per_page'])) * $config['per_page'];
} else {
$start = ($page-1) * $config['per_page'];
}
$order = "";
if($orderby) {
$order = $orderby;
}
$options = "";
if($option) {
$options = $option;
}
$limit = $config['per_page'];
$pages['list'] = $this->admin_m->get_list($method, $where, $start, $limit, $options, $order); //get_list($table='', $id='', $offset='', $limit='5', $option='')
$pages['cnt'] = $config['total_rows'];
$pages['page'] = $config['total_rows'] - $start;
return $pages;
}
어디에 orderby 과련 구문을 넣어야 할까요 ? |
|||
| 태그 | 페이징,page,pagination | ||
| 다음글 | sql 문 작성은 어떻게들 하시나요? (4) | ||
| 이전글 | 사용자의 접속 로그를 확인하고자 하는데 session ... (2) | ||
|
개락
/
2017/05/25 10:38:05 /
추천
0
|
$config['base_url'] 제일 뒷부분에 넣어주시면 되는데.. 아래글을 한번 참고하심이 좋을꺼같습니다.
http://www.cikorea.net/bbs/view/qna?idx=17285&page=1&view_category=&lists_style=