change controller's path

i want divide the controllers in controller folder in two different folders:

what i want is:




       \controllers

            \folder1

                ExampleController.php

             \folder2

                TestController.php



instead of:




        \controllers

              ExampleController.php

              TestController.php



Thanx in advance…

You can already do that, but your URL will become ‘example.com/folder1/example/action’.

If you don’t want to show ‘folder1’ in the URL, you need to add URL rules for each controller.

thanx

but if i seperated controllers and try to access like

appdirectory/index.php/folder1/example/admin

it is showing an error

ExampleController cannot find the requested view "admin"

i think there should be some changes in config file regarding changing the path of controller which i am missing…

The routing is working, it’s the view file that’s not loading in your render call.

Try making sure that the view folder structure mirrors the controller folder structure. Alternatively, specify the view to render using a full path.

thank you very much…

i changed view files path too… now its working…

Do any other error will occur??I mean,Do i need to change any other paths or any other setting??..

No. Just make sure that any links use the correct path.

ok…thank you…

same way if i seperate out the models then do i need to use mirror folder structureas view and controller??

The location of the models is irrelevant. You just need to make sure that the files can be automatically imported. The easiest way is to add your paths to the import array in your application config.

Seems like you’re working on reinventing modules.