Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Dynamic Theme Based On Url

$
0
0
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

Viewing all articles
Browse latest Browse all 18717

Trending Articles