I have a controller function that displays all records, I am using the pagination class to divide the records in pages. The controller looks a bit like that
class Example extends CI_Controller {
[...]
function All()
{
//Gets all the records
//Pagination uri_segment set to 3
}
}
Now i added the ability to search the records. I need the search term to be in the uri so the function is like function All($search_term = false). My issue is that the function may or may not have search terms. and depending on that, the uri segment of the pagination will change. without a search term uri_segment is 3, with it is 4.
Is there a way to fix that while using the same function and having the search term in the url?