Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.2
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

fla_style_switcher

fla_style_switcher is a stylesheet switching system. It enables a cookie-based style switcher system, based on Build a PHP Switcher by Chris Clark, published on alistapart.com.

Usage:

Replace the standard call to the css file in the “head” section of your page templates with: <txp:fla_style_switcher />.

You can specify a default stylesheet: <txp:fla_style_switcher default="otherdefault"/>
and specify the media this stylesheet is dedicated to: <txp:fla_style_switcher media="print" />

For stylesheet linking, please see the fla_altstyle_link plugin

Article Request Count:

Archived [?]: orphaned

Initially released:
04.08.17
Posted here:
26 Mar 2005
Article modified:
20 Jan 2008

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (7)

As anyone had problems with this plugin with RC3 ?

The < txp:fla_style_switcher /> is not parsed in the head call :

< link rel="stylesheet" href=" " type="text/css" />

doesn’t work….
Plugin is activated properly, the switcher links are there but doesn’t work with rev392…
I had a problem in that we are using one TXP install to run the business and a few blog sites…and I wanted a style switcher on all of them. The cookie that fla_style_switcher writes applies everywhere on the domain. I made some modifications to the code, adding some attributes.

“scope” is a unique identifier that defines a page/section of the site for which the given default stylesheet applies.

“days” defines how many days you want the cookie to be valid.

Here is the modified code:

function fla_style_switcher($atts)
{

$html = “”;

if (is_array($atts)) extract($atts);

$style_media = ($media) ? $media : “screen”;

$stylesheet = ($default) ? $default : $stylesheet;

$subdir = ($scope) ? $scope.”_” : “”;

$time = ($days) ? $days : “1”;

if (array_key_exists(“css”, $_GET))
{
$stylesheet = $_GET[‘css’];
}
elseif (array_key_exists($subdir.”txp_stylesheet”, $_COOKIE))
{
$stylesheet = $_COOKIE[$subdir.’txp_stylesheet’];
}

setcookie($subdir.”txp_stylesheet”, $stylesheet, time()+3600*24*$time, ”/”, $_SERVER[‘SERVER_NAME’], “0”);

$html .= “”;

return $html;
}
Great plugin! Saved me a whole lot of reading over at alistapart.com ;) Thanks!!

One question: Why isn’t this and the fla_altstyle_link plugin not one plugin?
Alex007:

Both pugins arent available – does anyone have a copy?

snitch:

I Can’t download the Plugins, it would be very cool if someone has a copy of them.

Regards SNitch

Both plugins come with the fireplay style theme, as I was wondering exactly the same thing. Just copy the data between the ‘ ‘ characters into the plugin admin on textpattern.

Both plugins come with the fireplay style theme, as I was wondering exactly the same thing. Just copy the data between the ‘ ‘ characters into the plugin admin on textpattern.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

Would you care to write a comment or visit the forum discussion?

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern