0
votes

My pagination not working properly.

For example my $count = 3, $limit = 1 so i should have 3 pages

And this pagination look like this: 1 2 3 >

1 - Its not clickable and always bold (as active)

2 - When i click on it my uri segment(4) change on '1', dont change on bold (as active)

3 - When i click on it my uri segment(4) change on '2', dont change on bold (as active)

' > ' - Working only when i dont have uri segment(4) and when i click segment(4) change on '1' but when i click again its not working. When segment(4) = '2' and click it change on '1'.

' < ' - doesnt show at all

Controller:

$value = $this->uri->segment(3);
$this->load->library('pagination');

$limit = 1;
$offset = $this->uri->segment(4);
$this->db->limit($limit, $offset);

$this->db->where('when_data >='. date('Y-m-d'));
$this->db->select('*');
$this->db->from('meeting');
$this->db->join('category', 'category.id = meeting.id_cat');
$this->db->join('users', 'users.id = meeting.id_p');
$data['meeting'] = $query = $this->db->get();

$count = $query->num_rows();

$config['base_url'] = base_url() . 'main/kategoria/'. $value;
$config['total_rows'] = $count;
$config['per_page'] = $limit;
$config['first_link'] = 'First';
$config['last_link'] = 'Last';
$config['cur_tag_open'] = '<b>';
$config['cur_tag_close'] = '</b>';
$config['next_link'] = '>';
$config['prev_link'] = '<' ;

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

$data['pagination'] = $this->pagination->create_links();

$this->load->view('spotkania/kategoria', $data);

View:

<?php echo $pagination; ?>

Any idea?

1

1 Answers

0
votes

you missed to add this config

$config['uri_segment'] = 4;//your case its 4.