Lior Elrom
Lior Elrom

Reputation: 20882

How To Show The First Page Number In The Default URL Using Pagination

I'm using the CodeIgniter pagination library for building my page's links. I defined a config array variable for my pagination as follows:

$config['use_page_numbers'] = true;

All of my URLs look like http://domain.com/class/function/# (where # is the page number I'm on). However, the first page looks like http://domain.com/class/function and is missing the first page (#1).

Is there a build-in way in CodeIgniter of showing the first page if no page number is in the URL?

Upvotes: 2

Views: 551

Answers (1)

kittycat
kittycat

Reputation: 15044

Yeah use a route. In your config/routes.php file add this:

$route['class/function'] = 'class/function/1';

This way if the page number is missing it will assume the number 1 is in the URL, so it will show page #1

Upvotes: 1

Related Questions