Dynamic Theme Based On Url

Hi,

How can I set a theme based the URL? I’ve tried amending /protected/config/main.php with the code below but it doesn’t work. $mytheme did not set to ‘mobile’ when I access the page at http://m.example.com.





$mytheme = 'classic';

 if (Yii::app()->request->hostinfo=='http://www.example.com/')

 	$mytheme = 'classic';

 if (Yii::app()->request->hostinfo=='http://m.example.com/')

 	$mytheme = 'mobile';


return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'Example',

	'theme'=>$mytheme,


...



Any help is appreciated. Thanks.

regards,

Ridz

Hi,

Solved the problem. See code below.




$mytheme = 'classic';

 if ($_SERVER['HTTP_HOST']=='http://www.example.com')

        $mytheme = 'classic';

 if ($_SERVER['HTTP_HOST']=='http://m.example.com')

        $mytheme = 'mobile';


return array(

        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

        'name'=>'Example',

        'theme'=>$mytheme,






regards,

Ridz