I decided to use an existing php solution by Rob Ballou.
I made a User Defined Tag and uploaded the file called switcher.php. Changed a few style sheet links to include files that I uploaded to a directory outside of CMS MS stylesheet and template management functionality and all is good.

Here's how you can do this too.
First upload your "Alternate" stylesheets into a new directory inside your CMS MS directory. For example, I created a directory called "custom" that holds my custom CSS and JavaScript files. Next, create links to your alternate CSS links inside your template(s) . One of these links will include a User Defined Tag. There's more information and the User Defined Tag code provided in the included file.
Now, modify the switcher.php file as instructed in the comment section and upload to your CMS MS root directory.
Here's the file. Note that the a User Defined Tag must be created. For a working style switcher, you will have:
- the switcher.php file uploaded to your CMS MS directory
- the setstyle tag created via the CMS Made Simple Admin Panel
- your alternate stylesheets uploaded to your a directory of your choice
- links to your alternate style sheets inside each of your template sections
- links inside your pages to provide visitors the option to switch styles
Code: Select all
<?php /*
###########CREDITS##############
Script created by: By Rob Ballou.
October 14th, 2002
(Last updated: August 06, 2003 13:24)
Original website article:
Another PHP Styleswitcher
http://www.contrastsweb.com/switcher/v1/
Thanks extended to Rob Ballou!
###########USAGE#############
###Create a CMS Made Simple User Defined Tag called, "Setstyle."
#Paste the following code into your User Defined Tag:
//Start setstyle
if(isset($_COOKIE['sitestyle'])){ // Use the saved style
print trim($_COOKIE['sitestyle']);
}
else { // There is not a cookie set, so use this style
print "default";
}
//end setstyle
#Change line 5 above, print "normal"; to reflect the name of your "default" stylesheet.
###Example Stylesheet link in the <head></head>:
#Place as the last entry inside the head of your web document any number of "Alternate Stylesheets." For Example,
<link rel="alternate stylesheet" type="text/css" href="larger.css" title="larger">
<link rel="alternate stylesheet" type="text/css" href="default.css" title="default">
#Followed by a "Persistent Stylesheet" with a CMS Made Simple User Defined Tag
called, "Setstyle."
<link type="text/css" rel="stylesheet" href="custom/{setstyle}.css" media="screen">
###Next, this script has to be modified to include the names of your "Alternate Stylesheets" and your website address. Modify Line Numbers: 55, 73, and 92.
###Next, upload this file to the root of your CMS Made Simple site or your CMS Made Simple directory.
###Example of a switcher link in an html document:
<a href="/switcher.php?set=larger">Switch to Larger Text</a>
<a href="/switcher.php?set=default">Switch to Default Text</a>
###########NOTES#############
For more information, visit the author's website at, http://www.contrastsweb.com/switcher/v1/
Or, visit the CMS Made Simple forum at,
###########Start of Switcher Script############## */
// This array lists the "acceptable" styles
$accept = array('default', 'larger');
// add more styles separated by commas
// Get style from a query string (e.g. from a link),
// or from a form.
if(isset($_REQUEST['set'])){
$style = trim(strip_tags($_REQUEST['set']));
}
else if(isset($_POST['set'])){
$style = trim(strip_tags($_POST['set']));
}
else {
// Unknown request
$style = false;
}
// Check if the requested stylesheet is "acceptable"
if(($style !== false) && (in_array($style, $accept))){
setcookie("sitestyle", $style, time()+31536000, '/', 'YOURDOMAIN.com', '0');
}
if(isset($_REQUEST['ref']) || (isset($_POST['ref']))){
if(isset($_REQUEST['ref'])){
$ref = $_REQUEST['ref'];
}
else {
$ref = $_POST['ref'];
}
header("Location: $ref");
exit;
}
else if(isset($_SERVER['HTTP_REFERER'])){
// Send the user back to the refering page
header("Location: ". $_SERVER['HTTP_REFERER']);
exit;
}
else {
// No HTTP referrer, send them back to the home page
header("Location: http://YOURDOMAIN.com");
exit;
}
?>
Also, the stylesheet links have to be the last thing before the closing tag so as not to conflict with the default, persistent styles.
I look forward to hearing any successes and questions. I'm using this on my first CMS MS site at optometricassociatesonlineDOTcom/new (I wrote the url like this so it isn't picked up by SE's - the new site will move to the root url in the next few days...) - Take a look at the source to see the style sheet links and etc...
-John B.
[gelöscht durch Administrator]