0

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?

Mr.Rendezvous
  • 1,933
  • 5
  • 20
  • 34
  • 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 Dec 02 '13 at 10:22
  • it works, but I need it to `http://localhost:8080/pmm/page/stok/2` – Mr.Rendezvous Dec 02 '13 at 10:38
  • Possible duplicate of [Pagination do not correct display page numbers Codeigniter](http://stackoverflow.com/questions/9046149/pagination-do-not-correct-display-page-numbers-codeigniter) – Damaged Organic Jan 09 '17 at 10:15

2 Answers2

0

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/';.

Damaged Organic
  • 8,175
  • 6
  • 58
  • 84
0

add this line to your controller before load pagination library

$config['uri_segment'] = 3; //or try 4
dev.bashar
  • 191
  • 1
  • 2
  • 14