CMS Made Simple Forums
https://forum.cmsmadesimple.org/

style switcher
https://forum.cmsmadesimple.org/viewtopic.php?f=7&t=305
Page 1 of 1

Author:  coolzeroz [ Thu Dec 30, 2004 12:20 am ]
Post subject:  style switcher

Hi,

I'm having problem getting cmsmadesimple to read cookies.

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


Read Cookie
user plugin called style
\$1:
<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.

Author:  Akrabat [ Thu Dec 30, 2004 8:01 am ]
Post subject:  Re: style switcher

The user plugin is already php, so you don't need the tags.
try changing your "style" userplugin to:
\$1:
echo '<link rel="stylesheet" type="text/css"
   media="screen" title="User Defined Style" href="' .
   (!$sitestyle)?'style':$sitestyle . '.css" />';

Author:  coolzeroz [ Fri Dec 31, 2004 9:22 am ]
Post subject:  style switcher

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.

Author:  Thomas Bøge [ Sat Jan 01, 2005 5:05 pm ]
Post subject:  style switcher

Thank You.

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

Author:  Anonymous [ Tue Jan 04, 2005 3:29 am ]
Post subject:  style switcher

here's the code

called this style.php
\$1:
<?php
setcookie ('sitestyle', $set, time()+31536000, '/', '.coolzeroz.com', '0');
header("Location: $HTTP_REFERER");
?>


Place this code in plugin and call it style
\$1:
if ($_COOKIE["sitestyle"]  == "")
{
   echo "default.css"
}
else
{
echo "$_COOKIE["sitestyle"].css";
}
 


After , place this code
\$1:
{style}


To call the script

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

Author:  coolzeroz [ Tue Jan 04, 2005 3:33 am ]
Post subject:  style switcher  Topic is solved

After , place this code
\$1:
<link rel="stylesheet" type="text/css" href="{style}" title="default" />

Author:  coolzeroz [ Tue Jan 04, 2005 3:40 am ]
Post subject:  style switcher

delete this post... the code does not work.

Author:  Ted [ Tue Jan 04, 2005 10:27 am ]
Post subject:  style switcher

See http://forum.cmsmadesimple.org/viewtopic.php?t=318 for the correct code.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/