style switcher

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
coolzeroz

style switcher

Post 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.
Akrabat

Re: style switcher

Post 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" />';
coolzeroz

style switcher

Post 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.
Thomas Bøge

style switcher

Post 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.
Anonymous

style switcher

Post 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>
coolzeroz

style switcher

Post by coolzeroz »

After , place this code

Code: Select all

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

style switcher

Post by coolzeroz »

delete this post... the code does not work.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

style switcher

Post by Ted »

Locked

Return to “Modules/Add-Ons”