mam problem otóż wykorzystuję bibilioteke standardową paginacji z CI, wszystko działa super jednak np. gdy już na 5,6 stronie sortuje sobie dane np. chce tylko mieć pliki z licencji freeware to jest pusto chodź na stronie 5 istnieje taki plik.
$this->load->model('File_model'); // Ładowanie modelu plików $config['base_url'] = base_url() . 'index.php/cat/lista/'.$this->uri->segment(3); $config['total_rows'] = $this->File_model->count_files($id); $config['per_page'] = 10; $config['num_links'] = 5; $config['first_link'] = 'Start'; $config['last_link'] = 'Koniec'; $config['full_tag_open'] = '<ul id="table-pagination">'; $config['full_tag_close'] = '</ul>'; $config['cur_tag_open'] = '<li>'; $config['cur_tag_close'] = '</li>'; //$config['suffix'] = '.html'; //do tagów w pagination $config['uri_segment'] = 4; $license = $this->sort(); $this->pagination->initialize($config); $file_list = $this->File_model->get_file_list($license,$id,$config['per_page'], (int)$this->uri->segment(4)); /** * Sortowanie z formularza z widoku: cat_list.php * @return string - lista licencji */ { if( $this->input->post('license_type') ) { $select_license = $this->input->post('license_type'); switch($select_license) { case 'free': $wlicense = '1,2,3'; break; case 'paid': $wlicense = '4,5'; break; case 'all': default: $wlicense = '1,2,3,4,5,6'; break; } } else { $wlicense = '1,2,3,4,5,6'; } return $wlicense; }
MODEL:
function get_file_list($license,$cat, $num="", $offset="") { $query = $this->db->query("SELECT licenses.name as nlicense, files.name as name, files.system_link as system_link, files.downloads as downloads, files.grade as grade, files.description as description, files.language as language, files.recomend as recomend, files.id as id, files.type as type FROM files LEFT JOIN licenses ON files.license = licenses.id WHERE files.cat IN ({$cat}) AND files.license IN ({$license}) ORDER BY files.name ASC LIMIT {$offset},{$num}"); return $query->result_array(); } /** * Zwraca liczbe newsów * @return <int> liczbe newsow */ function count_files($cat) { $query = $this->db->query("SELECT * FROM files WHERE cat IN ($cat)"); return $query->num_rows; }
Nie wiem co jest nie tak ehh ktoś ma jakąś wskazówke