we have an application which has page's result on the bases of certain parameters like domain.com/index.php/welcome/student/male
here welcome
is controller student
is method name male
is parameter, now we want pagination for this, but the problem is a person can also use sub category like this domain.com/index.php/welcome/student/male/steven
where steven
is another parameter, how to create pagination for this type of urls. Thank you in advance :)
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
I worked around with codeigniter but i think that maybe you have to use config/routes.php. For example with:
you could write a function in controller (in this case routes) like this:
I hope this help you Regards!
Some problems when having optional parameters along with pagination:
Method 1:
Use query strings for pagination:
Method 2:
Assuming the
category
would never be a number and if the last segment is a numeric value then it's the pagination offset not a function's parameter:I prefer the first method because it does not interfere with function parameters and it would be easier to implement the pagination support at an abstract level.