2012-08-25 2 views
4

처음으로 codeigniter의 페이징 클래스를 사용하고 있습니다. 다른 모든 것은 정상적으로 작동하지만 어느 페이지로 가든지 활성 링크는 항상 [1]이며 변경되지 않습니다. 또한 다음 버튼은 항상 첫 번째 페이지에 연결됩니다. 왜 그런지 알아 내지 못해! 도와주세요 !CodeIgniter 페이징 클래스, 활성 링크가 작동하지 않습니다.

컨트롤러

public function unverified_images() 
{   
    $data['title'] = 'Choose from the below Images to verify them >>'; 
    $data['total_rows'] = $this->admin_model->all_unverified_images(); 

    $config['base_url'] = base_url().'index.php/admin/admin/unverified_images'; 
    $config['total_rows'] = $data['total_rows']->num_rows(); 
    $config['per_page'] = 1; 
    $config['num_links'] = 8; 
    $config['full_tag_open'] = '<div class="pagination">'; 
    $config['full_tag_close'] = '</div>'; 

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

    $data['query'] = $this->db->where('image_status', 0) 
        ->get('tbl_img', $config['per_page'], $this->uri->segment(4)); 
    $data['links']=$this->pagination->create_links();  
    $this->load->view('admin/image_verify', $data); 
} 

public function verify_image() 
{ 
    $data['title'] = 'Choose from the below Images to verify them >>'; 
    $data['msg'] = $this->admin_model->verify_image(); 
    $data['query'] = $this->admin_model->all_unverified_images(); 
    redirect('admin/admin/unverified_images'); 
} 

모델

function all_unverified_images() 
{ 
    $this->db->where('image_status', 0); 
    $query = $this->db->get('tbl_img'); 
    return $query; 
} 

보기

<?php echo $links; ?> 

답변

6

그 CI 같은 소리가 당신이 있어야하는데 어떤 페이지를 알아낼 수 없습니다. $config 배열에 uri_segment 또는 cur_page을 추가해보세요.

uri_segment

많이, CI의 기본 3.

+0

문제가 해결되는 동안 (쿼리)에서 4 것 같다 귀하의 예제 코드에서 감사 현재 페이지 번호를 보유하고있는 URL의 어떤 부분 CI를 말해야 @ 복합 857 –

관련 문제