how to use action defined in other controller

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

you can check this http://www.yiiframew…ntroller-detail

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.

http://www.yiiframew…og/portlet.base

Actions can also be defined as a class, this way you can reuse them. Its described in the Yii-guide in the actions section.