Run Actions Using Different Controllers

Hi,

I have define following method in my DefaultController:




public function actions()

{   

   return array(

      'create'=>'activities.controllers.default.CreateAction',

      'index'=>'activities.controllers.default.IndexAction',

      'view'=>'activities.controllers.default.ViewAction',

      'update'=>'activities.controllers.default.UpdateAction',

      'delete'=>'activities.controllers.default.DeleteAction',

      'undelete'=>'activities.controllers.default.UndeleteAction',

      'session'=>'activities.controllers.session.IndexAction',

   );

}



You can see that "index" and "session" point to same action name "IndexAction" but under different controllers (default - DefaultController and session - SessionController)

Under a view of "index" - (activities.controllers.default.IndexAction), I am running "session" like below:




<?php

echo $this->run('session');

?>



But unfortunately page won’t finish loading. I think due to same action name (IndexAction), though I am using diffrent keywords (index and session).

Pls advice me how to achieve this using same action name (IndexAction), because I know I can achieve this using different names like below:




'index'=>'activities.controllers.default.IndexAction',

'session'=>'activities.controllers.session.SessionAction',



Thank you

What i got is u want to access the same action class but -

  1. from different controllers, and

  2. with different action name

To do this u just have to specify the same CAction Class file for both the actions.

Like:




public function actions()

{   

   return array(

      'index'=>'activities.controllers.default.IndexAction',

      'session'=>'activities.controllers.default.IndexAction',

   );

}



its same action class file location.


      'actionName'=>'path.to.action.class.file',

you specified different paths for the action class file, so its not loading the same view.