Welcome Guest, Not a member yet? Register   Sign In
Pagination :(
#1

[eluser]BobyKurniawan[/eluser]
Hey, it's me again. Maybe you'll get bored because me. Sorry Big Grin

Now i've a problem with pagination, well everything is work but the number in url is little weird

My first page
Code:
http://localhost/bycms/admin/kategori

My second page
Code:
http://localhost/bycms/admin/kategori/5

Is it really like that?

Okey, if that wrong. This is my controller

Code:
function kategori($offset=null)
{
$cek = $this->bymodel->cekaman();
if($cek!=null)
{
  $tbl='fc_kategori';
  $x = $this->input->post('cari');
$field= array('namakategori'=> $x);
    $data['include'] =  'admin/list_category';
    $config['base_url'] = base_url().'admin/kategori/.';
  $config['total_rows'] = $this->bymodel->hitungdata($tbl,$field,$x);
$config['per_page'] = '5';
$config['full_tag_open'] = '<div id="pagination">';
    $config['full_tag_close'] = '</div>';
  $this->pagination->initialize($config);
  $data['halaman'] = $this->pagination->create_links();
  $data['kategori'] = $this->bymodel->tampildata2($config['per_page'], $offset,$tbl,$x,$field);
$this->load->view('admin/page',$data);
}else{
$this->load->view('login');
}
}

My model

Code:
public function tampildata2($num, $offset,$tbl,$x,$field)
{
   $this->db->like($field, $x);
   $this->db->where('flag',1);
  $data = $this->db->get($tbl, $num, $offset);
  return $data->result();
}

Thanks before
#2

[eluser]CroNiX[/eluser]
That's normal. I assume you are displaying 5/page? That's the offset. If you want to display the actual page number instead, you'd need to set $config['use_page_numbers'] = TRUE; as per the user guide.
#3

[eluser]BobyKurniawan[/eluser]
[quote author="CroNiX" date="1405528567"]That's normal. I assume you are displaying 5/page? That's the offset. If you want to display the actual page number instead, you'd need to set $config['use_page_numbers'] = TRUE; as per the user guide.[/quote]

Man, you always help me with my "CI Problem" thanks a lot




Theme © iAndrew 2016 - Forum software by © MyBB