Welcome Guest, Not a member yet? Register   Sign In
How do I reconcile the idea of a controller and the idea of a 'page' in my Controllers?
#1

[eluser]adityamenon[/eluser]
I am currently building a non-trivial application, and all functionality is presented to the user in a 'Dashboard'.

I've always had this mapping in my head that one controller = one page, and as a result, my Dashboard Controller class is 3000 lines long, with disparate functions like display_users(), display_groups(), edit_users(), display_content_type_1(), display_content_type_2() and so on (note: I have redacted the real function names).

It looks obvious that all the "User" functions must be in its own class, content functions in their own class, and so on. In this case, does this look like a sane folder structure?

Code:
./controllers/Auth/Auth_controller.php
./controllers/Content/Content_controller.php
./controllers/Settings/Application_settings_controller.php

...and so on

Any suggestions or prior experiences in implementing such a thing?

Additionally, I am also interested in implementing PSR-0, assuming "Vendor" to be "My_app"..

Code:
./controllers/My_app/Dashboard/Auth/Auth_controller.php
./controllers/My_app/Dashboard/Content/Content_controller.php

- and then writing the autoloader into MY_Controller or elsewhere. Any advice from people who implemented this / thought it was a bad idea?

Thanks for reading Smile
#2

[eluser]adityamenon[/eluser]
Quote:mapping in my head that one controller = one page

Apologies, that was a mistake. My preconception is something more like: "one subURL the app = one controller", so, everything under http://site/dashboard/* goes into the Dashboard controller. This is what I meant.




Theme © iAndrew 2016 - Forum software by © MyBB