Yii Framework Forum: Admin Redirect - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Admin Redirect Rate Topic: -----

#1 User is offline   Sler 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 97
  • Joined: 17-July 12

Posted 04 August 2012 - 12:13 PM

Hello,

I have this "admin.php" 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,
0

#2 User is offline   Laverson 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 24-December 11

Posted 06 August 2012 - 06:01 PM

Try:

$this->render('admin');
Diego Laverson
0

#3 User is offline   riemann 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 31-August 11
  • Location:Algeria

Posted 06 August 2012 - 10:12 PM

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.yiiframew...rization-result
and http://www.yiiframew...bUser#returnUrl
0

#4 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,030
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 08 August 2012 - 09:29 AM

this should do it

$this->redirect(array('admin'));
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users