Call a action in different action with a same controller

hi everyone,

anybody can explain me that how could we call a different action or method in a action of controller.

for eg:- public function actionAbc(){

 /*

there i want to call a method of a same controller.

  */    


   $callaction=Xyz($i,$q);   





}

i am stuck with a syntax of Yii.anybody can help me here to solve my this problem.

Thanks in advance…!!

NOTE: are you using Yii 1.0.0 ? as you posted in that section!

If the action is in the same controller you use


$this->methodName()

Sorry but i am using Yii 1.1.7 now.but dont know where to post a thread related this version.


$this->methodName()

i have already use this syntax but it doesn’t work for me… :(

NOTE: moved to General Discussion for Yii1.1.x

Are the both methods in the same controller class?.. Do the method that you are calling return a value?..

Can you post your code… those two methods…

Actually i am trying to call a action which is using by ajax request url.

That is why i define this as a action in controller. and now i want to call this ajax action Url in in different action on run time…!!

i am using a custom ajax here on a view file…

and now i am just trying to call this ajax action in my different action.

You did not post any code… so I’m not sure I understand your need…

Is this example helping you:




public function actionAjax1()

{

   echo "action1";

}


public function actionAjax2()

{

   $val = $this->actionAjax1();

   echo $val;

   echo "action2";

}



if you call ajax1 you will get the ouotput "action1"… if you call ajax2 you will get "action1action2"…

thanks for your help sir…its work for me…!!

one more request to you…if you don’t mind then would you please check my one more post…here

pagination where data come from different models

i am struggling with this problem also on my project.it wolud be your great favor if you can help me on this point also.