Answer the question
In order to leave comments, you need to log in
Yii - common code for multiple controllers, right?
There is a project in which authorization is required to access resources. Implemented in such a way that the controllers folder contains subfolders Admin and User. It is necessary to make certain functionality that will be available to both the admin and some users. If we are dealing with an admin, there are no questions - we add a controller to controllers / Admin, a view to / view / admin - and there are no problems - the admin layout is saved for the admin, and the content is formed from the desired controller / view, made for this functionality .
If this functionality is needed for users with saving a custom layout, you need to duplicate the controllers from Admin to Users, but this is definitely wrong. How it is normal to implement it? Module, widget, something else?
OctoberCMS provides components for this - separate code and views that can be rendered anywhere in the main view while maintaining the layout.
Yii has a module mechanism, but I still haven't figured out if it's possible to render a module in an arbitrary view.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question