CI 묻고 답하기

제목 페이징 질문입니다.
카테고리 CI 2, 3
글쓴이 J데빌 작성시각 2016/10/20 01:37:01
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 15181   RSS

구글검색하고 여기저기 검색해봤는데.

잘안되네요. 일단 페이지버튼을 뿌리는데 실제로 페이지가 되지 않습니다.

<컨트롤러 부분>

$config = array();

$config["base_url"] = base_url()."/test1/test2/test3/";

$config["total_rows"] = $this->model->list_get();       

$config["per_page"] = 1;       

$config["uri_segment"] = 4;       

$choice = $config["total_rows"] / $config["per_page"];       

$config["num_links"] = round($choice);       

$config['page_query_string'] = true;

$this->pagination->initialize($config);

$page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;       

$data["result"] = $this->model->fetch_countries($config["per_page"], $page);       

$data["page"]  = $this->pagination->create_links();

$this->load->view(veiw.php, $data);

 

<모델 부분>

public function fetch_countries($limit, $start) {       

$this->db->limit($limit, $start);       

$query = $this->db->get("council_th");

if ($query->num_rows() > 0) {           

    foreach ($query->result() as $row) {               

        $data[] = $row;                           

     }           

     return $data;       

}       

return false;   

}

<뷰 페이지>

foreach($result as $key){

    $result -> data1;

    $result -> data2;

    $result -> data3;

}

echo $page

 

이렇게 했는데 막상 버튼을 누르닌까 변화가 없네요.

 다음글 ci3 세션 관련 문의 드립니다. (1)
 이전글 로그인과 회원가입 시 Codeigniter상에서의 암호... (6)

댓글

변종원(웅파) / 2016/10/20 02:38:35 / 추천 0
$page 변수 출력해보세요. 클릭할때마다 바뀌는지. 모델 쿼리도 출력해서 콘솔에서 직접 실행해보시구요