Rizwan Ranjha
Rizwan Ranjha

Reputation: 380

Codeigniter 3 pagination class and Query String with bootstrap 4

I am trying to use Bootstrap 4 with Codeigniter Pagination but want to add ?page=number. I am able to create pagination and it is working fine without

?page=number

but I need to use this for making it more SEO Friendly. I am already using this example but unable to get it working with Query String. Here is my code to enable Query String with the below example;

$config['enable_query_strings'] = TRUE;
$config['page_query_string'] = TRUE;
$config['use_page_numbers'] = TRUE;
$config['query_string_segment'] = 'page';
  1. Codeigniter 3 pagination class with bootstrap 4

I will be really thankful, if someone can help me or guide me on this. Thank you

Upvotes: 0

Views: 302

Answers (1)

user969068
user969068

Reputation: 2943

make sure you give valid URL in base-url config, you can remove all the params from URL like this.

$url = parse_url($_SERVER['REQUEST_URI']);
$config['base_url'] = site_url($url['path']);

and add

$config['reuse_query_string'] = true;

Upvotes: 0

Related Questions