pagination URI problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: pagination URI problem (/showthread.php?tid=54111) |
pagination URI problem - El Forum - 08-23-2012 [eluser]iamsen47[/eluser] This is my first time using CI, and probably the first time I've written my own PHP from scratch. I'm not a developer. Using XAMPP, this page will load 20 results perfectly. http://localhost/ci2/ When I click on next, it loads the next 20 results. http://localhost/ci2/supporttest/index/20 However, from here onwards, the next/prev link just keeps adding [/supporttest/index/#] to the URL. I've been trying to fix this, for the past few hours and I still don't know what the problem is. Somebody help please. http://localhost/ci2/supporttest/index/supporttest/index/40 http://localhost/ci2/supporttest/index/supporttest/index/supporttest/index/20 Code: public function index Only change I did to the route is switch welcome to my supporttest.php file. Code: $route['default_controller'] = 'supporttest'; This is the base URL I'm using in my config page. I've hidden index.php using .htaccess. Code: $config['base_url'] = 'http://localhost/ci2/'; pagination URI problem - El Forum - 08-23-2012 [eluser]NeoArc[/eluser] I always load the url helper, because most of the time you need it for pagination, routing and stuff. Code: $config["base_url"] = base_url()."supporttest/index/"; //!!Trailing slash pagination URI problem - El Forum - 08-23-2012 [eluser]Aken[/eluser] To explain that answer - base URL should be either a full URL or an absolute URL, not a relative one like you had. And use site_url() for links, not base_url(). pagination URI problem - El Forum - 08-23-2012 [eluser]iamsen47[/eluser] Thanks Aken, your advise worked. |