Welcome Guest, Not a member yet? Register   Sign In
controllers in subfolder - not working
#1

[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!!

#2

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

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

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB