Jonas Posted December 19, 2006 Share Posted December 19, 2006 Hi. I'm wondering, if I wanted to make a css file with the extension .php, and use php code in here, would that influence performance a lot? I'm thinking something like this:HTML <html><head><title>Untitled document</title><link rel="stylesheet" type="text/css" href="style.php" /></head><body>Lorem ipsum blablabla yadayadayada etc...</body></html> CSS <?php$colorname = $_GET['color'];?>body {background-color: <?php echo $colorname; ?>} I would then use the $colorname variable multiple times throughout the stylesheet, and the color would be a variable I would get from the URL, like: www.example.com/index.php?color=greenWould that be a good or bad way to be make a theme-choice, performance-wise and procedure-wise? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 19, 2006 Share Posted December 19, 2006 I don't think performance is going to be a problem. There's no processing there that would bog things down, just some printing. The main issue would probably be cache. Browsers tend to cache CSS pretty strictly, so if you had someone update their theme and then loaded the new page with the same CSS filename it would probably use the cached version. You would have to include your querystring arguments in the CSS sheet for it to access them (the CSS request wouldn't have access to the querystring for the main page), but that would probably get around caching anyway if there were URL parameters on the stylesheet path. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now