Yii Framework Forum: public function actionIndex() - Yii Framework Forum

Jump to content

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

public function actionIndex() Rate Topic: -----

#1 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,035
  • Joined: 30-October 09
  • Location:UK

Posted 08 February 2010 - 04:35 AM

I tried doing the following:

public function actionIndex()
{
$this->redirect(array('/admin'));
}


But it caused the yiic shell to break.

How can I acheive this without breaking the yiic shell? (basically I am trying to redirect users to index.php?r=admin when they access the site at the root).
0

#2 User is offline   Eliovir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 17-January 09

Posted 08 February 2010 - 04:55 AM

I also have that event (a trace log message for system.db.CDbConnection is shown in HTML) adding the code to the default controller.
0

#3 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,035
  • Joined: 30-October 09
  • Location:UK

Posted 08 February 2010 - 05:30 AM

I don't understand?
0

#4 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,349
  • Joined: 12-October 09
  • Location:Croatia

Posted 08 February 2010 - 05:56 AM

View PostGSTAR, on 08 February 2010 - 04:35 AM, said:

I tried doing the following:

public function actionIndex()
{
$this->redirect(array('/admin'));
}


But it caused the yiic shell to break.

How can I acheive this without breaking the yiic shell? (basically I am trying to redirect users to index.php?r=admin when they access the site at the root).


I just tried this one and works for me...

have you changed the actionIndex() in the SiteController.php?
Find more about me.... btw. Do you know your WAN IP?
0

#5 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,035
  • Joined: 30-October 09
  • Location:UK

Posted 08 February 2010 - 06:10 AM

Yes I am doing this in SiteController.

The redirect works fine but the yiic shell does not work.
0

#6 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,349
  • Joined: 12-October 09
  • Location:Croatia

Posted 08 February 2010 - 06:30 AM

View PostGSTAR, on 08 February 2010 - 06:10 AM, said:

The redirect works fine but the yiic shell does not work.


I can confirm this... if actionIndex() has a redirect, then the yiic shell is not working...
Find more about me.... btw. Do you know your WAN IP?
0

#7 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 08 February 2010 - 07:56 AM

In this case you could add the path to your config file to the yiic call.
0

#8 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,035
  • Joined: 30-October 09
  • Location:UK

Posted 10 February 2010 - 08:20 AM

Cheers Mike.

Anyone got any alternative fix?
0

#9 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,035
  • Joined: 30-October 09
  • Location:UK

Posted 10 February 2010 - 10:22 AM

I just created a new function in SiteController:

public function actionSite()
{
$this->redirect(array('/admin'));
}


And set that as $defaultAction.
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