pagination URI problem |
[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/s...t/index/40 http://localhost/ci2/supporttest/index/s...t/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/';
[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
[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().
|
Welcome Guest, Not a member yet? Register Sign In |