Howdy, I wasn't sure if this fell in into the CSS styling or layout sections so I have posted it here.
I am interested in changing CSS dynamically. Basically, I had the idea of creating a control panel so I could have a site admin set the background colors of different elements, creating different themes. Just like the front page of this site actually. Only, I would like the site admin to make the changes, and they show up the same on everyones screen instead of giving every user the options.
Is there a way to have a CSS file pull styles or attributes from a database?
I will continue to look on Google for ways of accomplishing this but I thought the great people here might have some insight.
Thanks.
changing styles dynamically
You can actually have your page use a PHP file for its CSS. You copy your CSS into a PHP file and add this to the top:
<?php ob_start ("ob_gzhandler"); header("Content-type: text/css; charset: UTF-8"); header("Cache-Control: must-revalidate"); $offset = 60 * 60 ; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; header($ExpStr); ?>
then link your page to the CSS.php file. So, then, as your CSS file is now a PHP, you can include in it whatever sort of logic you want.
Here's a bit more info about gzipping your CSS:
http://www.fiftyfoureleven.com/sandbox/weblog/2004/jun/the-definitive-css-gzip-method/