Can I Specify Common Controller For Advance Structure?

As someone has ask in stackoverflow question here

i wonder if we could specify common controller and view for frontend and backend part?

Because it must have some function it has business-logic quite the same, (but may be different in view).

Please advise,

The idea of using advanced application template in the first place is to separate frontend and backend logic (like 2 different sub-applications).

If you want a common controller (like in basic app)… you can consider implementing a module as an extension which you can access from both frontend & backend.

1 Like

You still need one controller for both the frontend and backend, but you could move SiteController to common/controllers and adjust the paths in the controller file to reflect the move. Then create new controllers for frontend and backend that are extended from SiteController (e.g., FrontendController and BackendController). The two new controllers could have no properties or methods or they could contain frontend or backend specific code. Those controllers will inherit the properties and methods in SiteController.

Within the two new controller files, you have the option of overloading specific methods from the SiteController class or the framework’s Controller class.