Yii using multiple topics

I want to configure at least two different themes for guests and admin users. It would also be useful to be able to customize different themes for different users. For example, a premium user will see things differently for the guest and the administrator.

When I try to follow in /config/main.php:

'theme'=>(Yii::app()->user->isGuest)?'bluebox':'classic',

it is always evaluated as false. I think the engine is not yet initialized. Is there any way to achieve this?

+5
source share
2 answers

You cannot configure multiple themes in the config.php file, you can do this in your controller.

public function init()
{
   if(Yii::app()->user->isGuest)
      Yii::app()->theme = 'bluebox';
   else
      Yii::app()->theme = 'classic';

   parent::init();
}
+14
source
+1

All Articles