for example, I have a login action in site controller, now I need to use it in admin controller, I know I can just copy the action into admin controller. However, is there a way to directly use it without duplicate the code
for example, I have a login action in site controller, now I need to use it in admin controller, I know I can just copy the action into admin controller. However, is there a way to directly use it without duplicate the code
For small snippets that are used on different pages you should use wigets.
In the portlet part of the blog tutorial is described how it works.
Actions can also be defined as a class, this way you can reuse them. Its described in the Yii-guide in the actions section.