Admin Redirect

Hello,

I have this[color="#00FFFF"] "admin.php" [/color]which is mainly the home page of an admin. It is located in protected/admin/views.

Now my real problem is this:

		// validate user input and redirect to the previous page if valid


		if($model->validate() && $model->login())


		    $this->render('admin.php'); //I've already customized this, but still it has an error.

I would like to redirect it to protected/admin/views/admin.php. How do I do this?

Chabx,

Try:

$this->render(‘admin’);

Hi,

You can also use Yii::app()->user->returnUrl to redirect to the previous url visited by user

as finded in documentation


Yii::app()->request->redirect(Yii::app()->user->returnUrl);

or in controller


$this->redirect(Yii::app()->user->returnUrl);

More on http://www.yiiframework.com/doc/guide/1.1/en/topics.auth#handling-authorization-result

and http://www.yiiframework.com/doc/api/1.1/CWebUser#returnUrl

this should do it

$this->redirect(array(‘admin’));