PHP Style Changer Experiment

Posted September 1st, 2006 by Mike Cherim

I wanted to open up this latest experiment for comments since it was the comments to Roger Johansson’s Build your own PHP style sheet switcher article that inspired me to add cookie acceptance detection functionality to my own PHP Style Changer Experiment. It seems to work nicely but I figure it’s always good to get some real-world feedback. And since I don’t accept comments at I figured I’d do it here. The link above leads to the supporting article, but here’s the actual experiment page, and here’s the well-commented script provided as a text file. Feel free to use it and tell others if you like it — it is safe from XSS so use it with confidence. It’s been in use a long time but I never released it.

For this experiment I’d like to say thanks to “ClamCrusher” at the SitePoint Forums who helped me unloop a loop that was driving me crazy. I also owe a nod to without whom I’d be dead in the water. I think Jona should also get a thank you for help with the original script over a year ago. He’s helped me so many times in the past I don’t really remember if he helped me with this or not, but I’d rather err on the side of caution and give thanks if thanks are indeed due. I’m just a PHP novice, but the language blows me away and I will continue to learn it. It’s amazing.

If you’ve never seen my experiments before, check it out as I have a number of them. Some are cool. Of the better ones I offer my CSS: Smart Corners, PHP: Font Sizer, CSS: Map Pop (combination CSS Image Map and CSS Popups), and many more; some refined, some quite experimental.

7 Responses to: “PHP Style Changer Experiment”

  1. Georg responds:
    Posted: September 3rd, 2006 at 10:43 am

    I’ll take a php stylesheet switcher over a javascript one any day - if I only want to switch between stylesheets.

    Now, since I rarely ever see the need for just switching between two or more stylesheets, it looks like I’m still stuck with the old javascript stylesheet swapper.
    You shouldn’t happen to know about a php solution that’ll let me combine and/or add/subtract any of a dozen or so stylesheets in any order at any time, do you..?

  2. Georg responds:
    Posted: September 3rd, 2006 at 1:55 pm

    Mike, yes I know php is powerful, but since my ability to do anything useful with php is virtually non-existent, I simply have to ask around about what it can do before spending time on learning php in depth. I’ll probably spend as much time on php as I have spent on CSS so far, so it would be a pity to find out after a while that it isn’t powerful enough - for me.

    As an example: on an old page - - created 2 years ago, I played around with a javascript stylesheet swapper. One regular stylesheet combiner for the basic section-wide variations, and an additional one for layout-variations on that page.
    A total of over 20 stylesheets combined in 6 different settings - 3 of which are memorized in a cookie and used across that site-section. All handled by one script.

    I know some of what I do on that page can be achieved better in php without involving swapping of stylesheets, but I’d like to have a php stylesheet switcher/swapper that is that powerful. Any problems with that that I should know about before throwing myself into mastering php?

  3. Georg responds:
    Posted: September 3rd, 2006 at 6:22 pm

    Ok Mike, I’ll put “mastering php” on my schedule, and see if I can make something useful out of it - one day. Might be fun.

Sorry. Comments are closed.

Note: This is the end of the usable page. The image(s) below are preloaded for performance only.