Mike’s Experiments - PHP: Style Changer

This PHP script checks to see if the user allows cookies. If so, a function is provided to change to an alternate CSS. If the user doesn’t accept cookies, this script offers a message, but normally it shouldn’t, and should instead simply remove the optional function from view.
Get the PHP, source. Go to back to the Mike’s Experiments index.


PHP: Style Changer Data, Output, and Interface

The is the raw data output by the script. It is these variables that, if properly employed, will alter the CSS import statement to grab the user’s preferred style sheet. Assuming, of course, cookies are allowed. Check it out:


Combining these variables in a CSS import statement will generate the following:

<style type="text/css" media="screen" title=""> 
    @import "";
</style>