public function actionOne()
{
//assume $model is declared
if(isset($_POST['Table1']))
{
//save the data and then redirect to another action
$this->actionTwo();
}
$this->render('One',array('model'=>$model));
}
public function actionTwo()
{
//assume $m1 is declared
//do something and render
$this->render('One',array('m1'=>$m1));
}
If i write like this than, what happens is:- in my browser two views are rendered at the same time.And I don’t want that to happen. So how to do???
public function actionOne()
{
//assume $model is declared
if(isset($_POST['Table1']))
{
//save the data and then redirect to another action
$this->actionTwo();
}
else
$this->render('One',array('model'=>$model));
}
but I think this call of another action in an action is not nice, what is your usecase scenario and why you don’t use redirect?
public function actionOne()
{
//assume $model is declared
if(isset($_POST['Table1']))
{
//save the data and then redirect to another action
$this->redirect(array('actionTwo'));
}
$this->render('One',array('model'=>$model));
}
public function actionOne()
{
//assume $model is declared
if(isset($_POST['Table1']))
{
//save the data and then redirect to another action
$this->actionTwo();
return;
}
else
$this->render('One',array('model'=>$model));
}