Page 1 of 1

style switcher

Posted: Thu Dec 30, 2004 12:20 am
by coolzeroz
Hi,

I'm having problem getting cmsmadesimple to read cookies.

Set Cookie
style.php

Code: Select all

<?php
setcookie ('sitestyle', $set, time()+31536000, '/', '.mydomain.com', '0');
header("Location: $HTTP_REFERER");
?>
Read Cookie
user plugin called style

Code: Select all

<link rel="stylesheet" type="text/css" 
	media="screen" title="User 
Defined Style" href="<?php echo 
(!$sitestyle)?'style':$sitestyle ?>.css" />
The problem is that when i switch the style to another style, it would use the default. I'd try echoing to see if it reads the cookie, but no luck.

I'd try using it outside cmsmadesimple, and it works.

Re: style switcher

Posted: Thu Dec 30, 2004 8:01 am
by Akrabat
The user plugin is already php, so you don't need the tags.
try changing your "style" userplugin to:

Code: Select all

echo '<link rel="stylesheet" type="text/css" 
	media="screen" title="User Defined Style" href="' .
	(!$sitestyle)?'style':$sitestyle . '.css" />';

style switcher

Posted: Fri Dec 31, 2004 9:22 am
by coolzeroz
I'd tried your suggestion. It didn't work. Thanks anyway.

I got it to work by myself. I'll post the code for the style switcher later.

style switcher

Posted: Sat Jan 01, 2005 5:05 pm
by Thomas Bøge
Thank You.

I will look forward to that. I need a style switcher to differenciate the layout for visually Impaired and non-visually impaired.

style switcher

Posted: Tue Jan 04, 2005 3:29 am
by Anonymous
here's the code

called this style.php

Code: Select all

<?php
setcookie ('sitestyle', $set, time()+31536000, '/', '.coolzeroz.com', '0');
header("Location: $HTTP_REFERER");
?>
Place this code in plugin and call it style

Code: Select all

if ($_COOKIE["sitestyle"]  == "") 
{ 
   echo "default.css"
} 
else 
{
echo "$_COOKIE["sitestyle"].css";
}
 
After , place this code

Code: Select all

{style}
To call the script

Code: Select all

<a href="style.php?set=default">Change to Default</a>

style switcher

Posted: Tue Jan 04, 2005 3:33 am
by coolzeroz
After , place this code

Code: Select all

<link rel="stylesheet" type="text/css" href="{style}" title="default" />

style switcher

Posted: Tue Jan 04, 2005 3:40 am
by coolzeroz
delete this post... the code does not work.

style switcher

Posted: Tue Jan 04, 2005 10:27 am
by Ted