Welcome Guest, Not a member yet? Register   Sign In
Routing issue?
#1

[eluser]Joe Dawson[/eluser]
Hello everyone,

Firstly, apologies if this has already been posted elsewhere but I wasn't sure exactly the problem is therefore what to search. Secondly, I am very new to Codeigniter, so apologies if something doesn't seem clear but bare with me. Smile

I installed the most recent version of Codeigniter (2.1.3) and then set the base_url inside of my 'config.php' file to the following address: http://www.joedawson.me/labs/codeigniter

I then created my new controller, 'portal.php', and was made aware from a tutorial I began following (http://net.tutsplus.com/tutorials/php/co...tch-day-1/) that you can set the default_controller inside of 'routes.php' so I did so - just to check this is correct, my code should be as follows... right?

Code:
$route['default_controller'] = "portal";

Just so who ever is reading this understands everything completely here is my 'portal' controller:

Code:
<?php

// Begin Portal Controller

class Portal extends CI_Controller {

function index() {
  $this->load->view('home');
}

function stats() {
  $this->load->view('stats');
}

}

So far so good, everything is running fine (at least I think it is, no errors are being returned). I have created my 'home.php' and 'stats.php' inside of my views folder just so you know. I then tried loading my 'stats' method from my 'portal' controller, but I ran into a problem.

As you can see, my 'home' view is being loaded fine: http://joedawson.me/labs/codeigniter/

But when I try loadings 'stats' I get the following: http://joedawson.me/labs/codeigniter/stats - I gather this is a .htaccess problem, I don't yet have one - when I extracted the .zip I didn't have one. Do I need one?

Assuming it's a .htaccess issue there, I then tried loading it like so: http://joedawson.me/labs/codeigniter/index.php/stats - Now I receive a 404?

What's weird, I can actually load it like so: http://joedawson.me/labs/codeigniter/ind...rtal/stats - which leads me back to my default_controller inside of 'route.php' - is that correct or am I doing something wrong?

Hopefully I explained that well enough (not too much, I hope) for someone to understand where I'm going wrong, I'd really appreciate the help!

Thanks, Joe Smile


Messages In This Thread
Routing issue? - by El Forum - 10-13-2012, 01:27 PM
Routing issue? - by El Forum - 10-13-2012, 01:48 PM
Routing issue? - by El Forum - 10-13-2012, 02:00 PM
Routing issue? - by El Forum - 10-13-2012, 02:04 PM
Routing issue? - by El Forum - 10-13-2012, 02:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB