Pagination's navigation don't work |
[eluser]someone [/eluser]
Last days I am playing with CI's pagination. I already set up config and the thing works perfectly. In the function of controller I have created some IF statements which are checking url. IF url is localhost/CI/index.php/controller/function/news THEN return first page of results from database -> first page BUT IF url is localhost/CI/index.php/controller/function/news/10 THEN return second page of results from database -> second page But there's problem because CI's pagination works with navigation only if there is number of results after the controller's function -> localhost/CI/index.php/controller/function/10 . Is there any workaround to do navigation with url like this localhost/CI/index.php/controller/function/news/10 ? (I have news, categories and other functions where I would like to show some basic informations about it.)
[eluser]skunkbad[/eluser]
CI pagination only works with a URI segment, but you can choose which one. Well, that's not entirely true, you can use a query string, but that's not usually the best solution. If you don't want to see the pagination numbers, you could try a javascript solution, like the one I used in Community Auth for user management. If javascript is disabled it falls back to standard pagination via the number in the URI segment.
[eluser]someone [/eluser]
Thanks, I've just forgotten to add uri_segment in config. So the answer on this question is, that I have to add $config['uri_segment'] = 4; |
Welcome Guest, Not a member yet? Register Sign In |