Help with pagination and mod_rewrite(Solved) |
[eluser]fraserk[/eluser]
Hi Everyone. I'm creating my first project in codeigniter and have run into a little problem. I think because I am using mod_rewrite to remove the index.php from my url the pagination is not working. When you click to go the the second page in the pagination link, it giving a 404 page not found error. Pagnation Code in Controller Code: $config['base_url'] = "http://www.goingclubing.com/"; Code in Model Code: $query = $this->db->get('events', 20, $this->uri->segment(3)); htaccess Code Code: RewriteEngine on Im not sure what I should I should use for the ['base_url']. Thanks...
[eluser]therealjerdev[/eluser]
[quote author="fraserk" date="1259856615"]Hi Everyone. I'm creating my first project in codeigniter and have run into a little problem. I think because I am using mod_rewrite to remove the index.php from my url the pagination is not working. When you click to go the the second page in the pagination link, it giving a 404 page not found error. Pagnation Code in Controller Code: $config['base_url'] = "http://www.goingclubing.com/"; Code in Model Code: $query = $this->db->get('events', 20, $this->uri->segment(3)); htaccess Code Code: RewriteEngine on Im not sure what I should I should use for the ['base_url']. Thanks...[/quote] I'm definitely having the same problem. Is there a fix?
[eluser]CroNiX[/eluser]
base_url should be http://yoursite.com/controller/method/ Then it will add the page number to the 3rd segment for all paginated links
[eluser]therealjerdev[/eluser]
[quote author="CroNiX" date="1393125370"]base_url should be http://yoursite.com/controller/method/ Then it will add the page number to the 3rd segment for all paginated links[/quote] Wow thanks so much. It finally works lol. Does CodeIgniter mention that in its userguide/references? Because I believe I haven't seen such documentation.
[eluser]CroNiX[/eluser]
Yes, in the very first example, and just below that it says: Quote:base_url This is the full URL to the controller class/function containing your pagination. In the example above, it is pointing to a controller called "Test" and a function called "page". Keep in mind that you can re-route your URI if you need a different structure. |
Welcome Guest, Not a member yet? Register Sign In |