Thanks for those useful techniques both.
I’ve decided to simplify my style switcher to be based around a simple snippet instead of the plugin approach.
this is because the template switcher makes if difficult to have multiple templates across the site as the template being used is based on a cookie value and not the documents template.
my snippet
<?php
/*
* A simple stylesheet switcher
* Author: Stewart Dinage
* [email protected]
* version 0.1
*/
$switchTo = "site1.css";
if (isset($_GET['stylesheet'])) {
$switchTo = $_GET['stylesheet'];
setcookie("stylesheet",$switchTo,time()+604800, "/", "", 0);
}
else if (isset($_COOKIE['stylesheet'])){
$switchTo = $_COOKIE['stylesheet'];
}
return $switchTo;
?>
this snippet is called in the template like so
<link rel="stylesheet" href="[(base_url)]assets/templates/default/[[styleSwitcher]]" type="text/css" media="screen" />
and allows a simple url value to be written to a cookie and change the stylesheet used.
it could do with a bit more attention to allow the default stylesheet to be named at the time of snippet call but functionally does the job.
if anyone else has any nifty stylesheet/template ideas for switchers let me know.
I think they’re very useful for offering differently accessible versions of your website, we could maybe suggest the best method choosen as a core snippet as its such a useful feature?