Friday, February 28, 2014

[CodeIgniter][Solved with images] codeigniter pagination display wrong current page number



The problem is whatever the current page number in url is 2 or 3, 
the number 1 is in pagination is always bold. 
Let me show the problems in the pictures first so that would be clearer:






And about how to solve the problem, I found the answer in stackoverflow, the answer is by Thorpe Obazee. I have changed a bit to fit my situation.

Add this line to the config array in the controllers.
And change the number within the quotation marks :


$config['uri_segment'] = '4';


There is my controller for an example:


About what is the number should write into the quotation marks, It’s depend on your URL.

In my case, the pagination number in URL is located at url segment 4, so I use number 4

Give you another example:


In this case, the pagination number in URL is located at url segment 3, so you need to use number 3


$config['uri_segment'] = '3';


** Result after fixed** 


Reference:


No comments :

Post a Comment