CodeIgniter Forums
controllers in subfolder - not working - 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 in subfolder - not working (/showthread.php?tid=51371)



controllers in subfolder - not working - El Forum - 05-01-2012

[eluser]Unknown[/eluser]
Hi,
I am new to CI and trying to build a PHP application.
As it is going to be a fairly big application I need to put my controllers in sub folders according their functionality to organize it better.

I have created a folder named app under controllers folder

C:\wamp\www\testapp\application\controllers\app
I have put two files in it
application.php
createapp.php

Createapp.php code:

Code:
<?php
   class Creatapp extends CI_Controller {
     public function index() {
      //load the helpers
      echo "test";
     }
   }
  
?>

application.php code:

Code:
<?php
    
   class Application extends CI_Controller {
     public function index() {
         echo "testapp";
    }
   }
  
?>

I am facing trouble in accessing createapp controller whereas the application controller is working fine.

If I access http://localhost/testapp/index.php/app/application/
I am able to access it successfully

If I access http://localhost/testapp/index.php/app/createapp/
I get a 404 not found error.

I am not sure what I am doing wrong. Please help!!




controllers in subfolder - not working - El Forum - 05-01-2012

[eluser]Unknown[/eluser]
Sorry, guys my mistake.. I just figured out.

There was difference between the php file name and class name.

Thanks