Question

Can one create a Yii theme with custom settings/options for each user?

For eg: each user can choose colours(background, foreground, text) and then be able to view the website as per their choices.

I understand using/creating different themes for different users, but can one customise themes based on user input?

Was it helpful?

Solution

Yes you can, according to the different choices, you can have the user select the color he/she wants and then you can set up a node.js server to render out a CSS script accordingly.

Check out how bootstrap uses this method to save the file according to the users choice :

http://twitter.github.io/bootstrap/customize.html

Then, rather than making the file downloadable, you can store it in the users directory and have the location of it also stored in the Database and next time, you can use Yii to call for the specified CSS file in the HTML page. This would change the look and each user can have different looks.

Ex :

<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/user/<?php echo $user->name."css"; " media="print" />

Hope this helped. Comment it you need any more information.

Regards,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top