Calling the action in another controller

In the index Action of siteController, I’d like call the Show action of companyController.

What is the code to accomplish this?(I haven’t seen anybody doing this) or maybe this design structure is not good.

siteController extends Controller

{

public function actionIndex()


{


/* <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />? how to call the Show action of companyController <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />? */


}

}

Please let me know your thoughts. Thank you!

Regards,

Nicolas Xu

There’s a similar post about this: http://www.yiiframework.com/forum/index.php?/topic/12339-calling-methods-from-another-controller/

It’s really not good practice, so think of a way around it if possible. As you can tell by the solution in the thread above (5 posts down), it’s quite messy. As this isn’t default behaviour (think of how easy it is to include a model and act on it), it’s an indication that it’s breaking good MVC architecture.

Thank you so much for your post.

Thanks a lot! It’s a real learning for me.