hi, i want users to have a feature where users can select color, font ,font size, font color etc. is it possible to write php code inside css files like
Yep, just how phtamas said. I implemented this recently for a cms project.
In my controller
public function actionLayoutCss()
{
$css = $this->renderPartial('index', array(
'css' => get my css data from db and send it to view
), true, false);
$this->renderCss($css);
}
I extend my CController (this is not necessary, you could just do this from the controller) with that renderCss method which is simply
And my view is a php file, so I can use data from the database, like a chosen background color.
/**
* My Sites Custom Layout CSS
* <?php echo date('Y-m-d H:i:s', time()) . "\r\n"; ?>
*/
body { background-color: <?php fetch it from db (probably passed from the controller); ?>; }