I am updating a CMS and I needed to use different CSS styles for different pages and times. But having much CSS's like page1.css, page2.css, midnight.css is not enough for me. So, here is a simple trick I did:
In the html page:
Then in the stylesheet (style.css.php):
You maybe will need it for causes like, when you want to change the background depending on whats stored in cookies:
Goodnight!
In the html page:
PHP Code:
<link rel="stylesheet" type="text/css" href="style.css.php" />
PHP Code:
<?php
header("content-type: text/css");
?>
then here goes the CSS code.
PHP Code:
body {
background-color: <?php echo $_COOKIE["bg"]; ?>;
}
Comment