0
votes

my setting for codeigniter pagination was this:

$this->load->library("pagination");
$config = array();
$config['base_url']     =  site_url('page/stok');
$config['total_rows']   = $this->posting_model->count_all_stok();
$config['per_page'] = 10;
$config['uri_segment']  = 3;
$config['use_page_numbers'] = TRUE;

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

but how come my page url become like this if I hover to page 2:

http://localhost:8080/pmm/page/stok/10

what do I wronged here?

2
I might assume that it's typical for calling site_url() on localhost. Does http://localhost:8080/pmm/page/stok/10 works or you getting errors? - Damaged Organic
it works, but I need it to http://localhost:8080/pmm/page/stok/2 - Mr.Rendezvous

2 Answers

0
votes

This is how site_url() works if you did not set base_url in config/config.php. Try to specify it correctly: $config['base_url'] = '//yoursite.com/';.

0
votes

add this line to your controller before load pagination library

$config['uri_segment'] = 3; //or try 4