| 제목 | paging이 안되네요... | ||
|---|---|---|---|
| 글쓴이 | 무소유 | 작성시각 | 2012/03/22 03:17:28 | 
| 
                         | 
                |||
                        
class Project extends CI_Controller {
 function index() {
 }
 //상품(프로젝트) 리스트
 function projectlist() {
  $this->seg = new search_seg();
  $perpage = 4;
  $page = $this->seg->get_seg('page') > 0 ? $this->seg->get_seg('page') : '1';
  $start = ($page - 1) * $perpage;
  $this->db->order_by('pj_idx','desc');
  $qry = $this->db->get('project', $perpage, $start);
  
  $this->load->library('pagination');
  $config['base_url'] = '/project/projectlist/page/';
  $config['total_rows'] = $total ;
  $config['per_page'] = $perpage;
  $config['uri_segment'] = 4;
  $config['full_tag_open']  = '<div id=pagination>';
  $config['full_tag_close'] = '</div>';
  $config['cur_tag_open']  = '<span class=current>';
  $config['cur_tag_close'] = '</span>';
  $this->pagination->initialize($config);
  $data['paging'] = $this->pagination->create_links();
  foreach($qry->result_array() as $row) {
      $data['list'][] = $row;
  }
  $this->load->view('adm/projectlist',$data);
 }
}
  | 
                |||
| 다음글 | 페이징 하나만 더 질문이요~ ^^;; (4) | ||
| 이전글 | 개발시 개발도메인 실서버도메인 어떻게 하시나요? (4) | ||
| 
                             
                                변종원(웅파)
                                /
                                2012/03/22 08:00:43 /
                                추천
                                0
                             
                            
                                $total 값이 없네요.
그리고 하단의 foreach는 전혀 쓸모없는 코드입니다. 데이터를 변경하지도 않는데 배열을 다시 배열에 담고 있습니다.
RESULT->ARRAY()를 12라인으로 옮기고 그다음 라인에 $total 구하는 걸 넣으세요
                             
                         | 
                    
| 
                             
                                무소유
                                /
                                2012/03/22 13:56:29 /
                                추천
                                0
                             
                            
                                웅파임 감사합니다.  
                        $qry = $this->db->get('project', $perpage, $start); 
                             |