php codeigniter pagination semantic-ui

php - paginación de error en codeigniter



pagination semantic-ui (1)

Quiero hacer que la paginación en codeigniter sea su trabajo, pero cuando hago mookup en config / pagination.php no funciona. hago semántica-ui para hacer esto.

esto es config / pagination.php

$config[''first_link''] = FALSE; $config[''last_link''] = FALSE; $config[''next_tag_open''] = ''<a>''; $config[''next_tag_close''] = ''</a>''; $config[''prev_tag_open''] = ''<a>''; $config[''prev_tag_close''] = ''</a>''; $config[''cur_tag_open''] = ''<a class="item" href="#">''; $config[''cur_tag_close''] = ''</a>''; $config[''num_tag_open''] = ''<a>''; $config[''num_tag_close''] = ''</a>'';

controlador

private function _kegiatan()

{$ this-> load-> model (''mkegiatan'');

//$this->db->where(''tanggal_kegiatan'', $slug); //$this->db->where(''id'', $id); $count = $this->db->count_all_results(''kegiatan_ukm''); var_dump($count); // Set up pagination $perpage = 2; if ($count > $perpage) { $this->load->library(''pagination''); $config[''base_url''] = site_url($this->uri->segment(1) . ''/''); $config[''total_rows''] = $count; $config[''per_page''] = $perpage; $config[''uri_segment''] = 2; $config[''first_page''] = ''Awal''; $config[''last_page''] = ''Akhir''; $config[''next_page''] = ''&laquo;''; $config[''prev_page''] = ''&raquo;''; $this->pagination->initialize($config); $this->data[''pagination''] = $this->pagination->create_links(); $offset = $this->uri->segment(2); } else { $this->data[''pagination''] = ''''; $offset = 0; } var_dump($this->data[''pagination'']); //$this->db->where(''tanggal_kegiatan <='', date(''Y-m-d'')); $this->db->limit($perpage, $offset); $this->data[''kegiatan''] = $this->mkegiatan->get_kegiatan();

}

llamar a la vista

<div class="pagination"><?php echo $pagination; ?></div>

por favor ayúdame que hacer.

gracias.


cambia tu configuración de esta manera

$config [''pag''] = array( ''full_tag_open'' => ''<div class=>"ui pagination menu">'', ''full_tag_close'' => ''</div>'', ''first_link'' => FALSE, ''last_link'' => FALSE, ''first_tag_open'' => ''<a class=>"item>'', ''first_tag_close'' => ''</a>'', ''last_tag_open'' => ''<a class=>"item>'', ''last_tag_close'' => ''</a>'', ''next_tag_open'' => ''<a class=>"icon item"><i class=>"icon right arrow">'', ''next_tag_close'' => ''</i></a>'', ''prev_tag_open'' => ''<a class=>"item">'', ''prev_tag_close'' => ''</a>'', ''cur_tag_open'' => ''<a class=>"active" href=>"#">'', ''cur_tag_close'' => ''</a>'', ''num_tag_open'' => ''<a class=>"icon item"><i class=>"icon left arrow">'', ''num_tag_close'' => ''</i></a>'' );

y deberías cargar config en el controlador

if ($count > $perpage) { $this->load->library(''pagination''); $this->load->config(''pagination''); $config = $this->config->item(''pag'') $config[''base_url''] = site_url($this->uri->segment(1) . ''/''); $config[''total_rows''] = $count; $config[''per_page''] = $perpage; $config[''uri_segment''] = 2; $config[''first_page''] = ''Awal''; $config[''last_page''] = ''Akhir''; $config[''next_page''] = ''&laquo;''; $config[''prev_page''] = ''&raquo;''; $this->pagination->initialize($config); $this->data[''pagination''] = $this->pagination->create_links(); $offset = $this->uri->segment(2); }