CodeIgniter Forums
Controllers/Classes not loading... - 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: Controllers/Classes not loading... (/showthread.php?tid=14001)



Controllers/Classes not loading... - El Forum - 12-15-2008

[eluser]tamilsweet[/eluser]
I'm facing a strange issue. All the url requests goes to the default controller/class. Other classes aren't loading??? How do i debug this?


Controllers/Classes not loading... - El Forum - 12-15-2008

[eluser]xwero[/eluser]
check the routes.php file.

There is no default controller in CI only a default controller method.


Controllers/Classes not loading... - El Forum - 12-15-2008

[eluser]tamilsweet[/eluser]
This is what I have in routes.php
$route['default_controller'] = "my_admin";

I have,
class My_admin extends Controller {
and
class My_login extends Controller {

http://mysite.com/index.php/my_login/ goes to My_admin !!!??


Controllers/Classes not loading... - El Forum - 12-15-2008

[eluser]xwero[/eluser]
The default controller is not really a default controller. It is the controller that only gets loaded when the uri has no segments. maybe it should be renamed to landing_controller?

Why do you add the MY_ prefix this looks ugly in the url. If the idea is to create extended controller classes you put them in the MY_controller file. Then they are loaded automagically. Then you create a controller that gets called by the url and extend that controller with a controller from the MY_controller file.
Code:
// MY_controller.php
class Admin extends Controller {}
class Login extends Controller {}
// controller that gets called by a url
class Users extends Admin {}

What is your file structure?


Controllers/Classes not loading... - El Forum - 12-15-2008

[eluser]FragPacket[/eluser]
Sounds like you and I are having the same problem...

http://ellislab.com/forums/viewthread/99891/


Controllers/Classes not loading... - El Forum - 12-15-2008

[eluser]tamilsweet[/eluser]
Hi xwero, Thanks for the response. I'm new to CI and I should first read the documentation properly.
Those weren't extended controller classes. I will rename them as you suggested.

I fixed the issue somehow.
* Added the htaccess rule
* Removed index.php in line => $config['index_page'] = "";
* Changed uri protocol to => $config['uri_protocol'] = "REQUEST_URI";

After these changes I'm able to get the code working properly.

Hello FragPacket, May be you could try this !?