I took a look around and decided that I am going to make a tiny free PHP Script – a CSS style switcher for designers. I am making this script for a free to download and use.
- No PHP Knowledge required at all, No installing, just drop the file in your CSS Folder, and make sure the server supports PHP.
- Ideal to showcase your work in multiple stylesheets but one HTML File.
- Automatically sets a default CSS File in this order:
- Look for style.css to set as default
- If not found, look for default.css
- If not found scan the directory for CSS files and use the first one found (ordered alphabetically)
- Use Links to change styles. So <a href=”css/switch.php?style=another.css”>Another Style</a> is going to switch the style, set a cookie for 1 hour and then redirect back to last page. If last page visited can’t be found (HTTP_REFERER) PHP script will redirect back to index of the site.
- Download the script
- Insert switch.php to your CSS Folder (In best scenario, you have a seperate folder with CSS files, if not, it’s okay, the script filters CSS files when listing them)
- In the site <head> insert something like this:
Bugs & Bugfixes
v0.3 – Added a feature to reload back to site domain if HTTP_REFERER Not found
v0.2 – Fixed Stylesheet file format. Now works with all HTML Versions. (php header content type changed to text/css )
- GZipped output (faster load times)
- Optimization if needed
- Support for multiple CSS files at once (so multiple CSS files would be included with a single request, just in case someone needs that 🙂 )
I hope you enjoy the script!
And now you can either see it in action or download it!
[button url=”http://demo.themer.me/css/” style=”green” size=”large”] See the demo [/button] OR [button url=”https://github.com/justnorris/CSS-Style-Switcher” style=”orange” size=”large”]Download Switcher PHP Script[/button]