pagination and uri_segment |
[eluser]fanch[/eluser]
Hello! i'm too new to CI to prentend having ancounter a bug. There's must be a mistake in my code! I've read documentation and browsed forums but i can't find where! Any help is welcome: I want to a simple pagination with sorting features. Here is the code: Code: <?php The search function works great, i can type url such like: Quote:http://10.153.9.6/dev/index.php/projects...ay/id/desc But the pagination links are wrong, I obtain: Quote:http://10.153.9.6/dev/index.php/projects...ay/id/desc/0/240instead of: Quote:http://10.153.9.6/dev/index.php/projects...ay/id/desc/240I thought the problem was in the "uri_segment', but I think 5 is the correct value: Code: // base url / 1 / 2 / 3/ 4 / 5 I've missed something. Any idea? thanks! fanch
[eluser]182armin[/eluser]
Hello, I am too new to CI, but i think its beacouse of your offset in function display: Code: function display($sort_by = 'id', $sort_order='desc', $offset = 0)
[eluser]InsiteFX[/eluser]
For help you need to show the code for: Code: $this->project_model->search($limits,$offset,$sort_by, $sort_order);
[eluser]bosse2nage[/eluser]
Thanks Armin but I have to passed $offset in my function display. Haven't I? InsiteFx: sure here is the code of the search function: Code: function search($limits, $offset, $sort_by, $sort_order) { This function works well: when I enter the search criteria "by hand" in the url, it displays the correct result. Note that the SQL query is adapted to Sql-Server.
[eluser]bosse2nage[/eluser]
I have tried to change the "uri_segment" value but no improvements... Best, Bosse
[eluser]bosse2nage[/eluser]
We found the error! The $offset should be removed from the "base_url": Code: $config['base_url']=site_url("projects/display/$sort_by/$sort_order"); instead of Code: $config['base_url']=site_url("projects/display/$sort_by/$sort_order/$offset"); Thanks everyone for your help!!! |
Welcome Guest, Not a member yet? Register Sign In |