Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » CSS Chooser

#49 2005-09-12 16:47:49

strawberryfusion
Member
Registered: 2005-07-24
Posts: 20

Re: CSS Chooser

Hi,

I have installed the plug-in and it works fine on the home page only – other pages I am unable to switch the style sheets – any idea where I may be going wrong?

Many thanks
rajiv

Offline

#50 2005-09-16 17:21:52

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Re: CSS Chooser

Does this switcher let you have a class for the active style?

I’d like to shift the background image of the active style image to let users know which they have selected.

Offline

#51 2006-02-08 00:49:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: CSS Chooser

Top plugin, but I found a small snag tonight that I can’t figure out: my error_default page isn’t being styled. It appears to be mangling/not parsing the txp:fla_style_switcher tag properly. Am I trying to get it to do something that’s just not possible and I need to hard-code my stylesheets under error conditions?

If I put a bogus URL in the address bar, the unstyled error page that I get back has the following code instead of the usual <link rel=.../> line:

<link rel="stylesheet" href="<txp:css n="classic" />" type="text/css" media="screen" />

My default stylesheet is classic.css. I’ve tried it with and without the default="classic" argument, but there’s no change. I thought maybe it was related to the fact my server was in Testing mode but setting it Live made no difference, nor did editing publish.php as described by Sencer. I know, I was clutching at straws!

I have it set up so that my page templates call a “head” form that contains the txp:fla_style_switcher tag. The error_default page appears to be parsing all the other tags correctly, just not this one. Anybody any ideas? Can anyone confirm these findings or is it just me? I’m running TXP 4.0.3.

Thanks in advance.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#52 2006-03-04 19:33:36

nonunique
New Member
Registered: 2006-03-04
Posts: 2

Re: CSS Chooser

We ran in to a problem in that we are using the same TXP install to run the business site and a couple of blogs, all of which needed a styleswitcher. This style switcher stores the same css for the whole domain. To accomodate our needs, I made some changes to the code and added some attributes.

“scope” is a unique identifier that specifies a page/section to which the default css applies.

“days” is how long you want the cookie to be valid for.

The new code looks like:
<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.”_” : “”; </code> <code> $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 .= “<link rel=\“stylesheet\” href=\”<txp:css n=\”“ . $stylesheet . “\” />\” type=\“text/css\” media=\”“ . $style_media . “\” />”;

return $html; }
</code>

Offline

#53 2006-07-03 07:55:30

stellularx
Member
Registered: 2005-05-06
Posts: 13

Re: CSS Chooser

is there a way to put the list of options in a drop-down menu in order to switch styles? thanks. :)

Offline

#54 2006-07-03 12:09:51

nonunique
New Member
Registered: 2006-03-04
Posts: 2

Re: CSS Chooser

Unless you want everyone to have access to ALL style options in your TXP install (which I can’t imagine being a good idea), you’ll want to define your own options in the page rather than hard-code it into the plugin.

We have a template running at <a href=“http://www.6footdesign.com/spectral”>our website</a> that has the drop-down style switcher like you are talking about. The template has several basic color schemes, within which there are several different header-styles. The relevant code looks like:

<code>
<form style=“display:inline;” action=“http://www.6footdesign.com/spectral/” method=“get”>
Blue: <select name=“css” onchange=“submit(this.form)”>
<option value=”“></option>
<option value=“spectral-blue”>0 – Default Blue</option>
<option value=“blue-1”>1 – Sunrise</option>
<option value=“blue-2”>2 – Plastic Chair</option>
<option value=“blue-3”>3 – Clouds</option>
<option value=“blue-4”>4 – Pixels</option>
<option value=“blue-5”>5 – Lightning</option>
<option value=“blue-6”>6 – Rose</option>
<option value=“blue-7”>7 – Eye</option>
</select><noscript><input type=“submit” value=“go” /></noscript>
</form>
<form style=“display:inline;” action=“http://www.6footdesign.com/spectral/” method=“get”>
Orange: <select name=“css” onchange=“submit(this.form)”>
<option value=”“></option>
<option value=“spectral-orange”>0 – Default Orange</option>
<option value=“orange-1”>1 – Orange Sun</option>
<option value=“orange-2”>2 – Flame 1</option>
<option value=“orange-3”>3 – Flame 2</option>
<option value=“orange-4”>4 – Poppies</option>
<option value=“orange-5”>5 – Sun Flower</option>
</select><noscript><input type=“submit” value=“go” /></noscript>
</form>
….
</code>

I hope this helps.

Offline

#55 2006-07-03 15:00:41

stellularx
Member
Registered: 2005-05-06
Posts: 13

Re: CSS Chooser

helps a lot. thanks so much! :)

Offline

#56 2006-08-22 21:23:56

-rr-
Member
Registered: 2005-09-11
Posts: 73

Re: CSS Chooser

I’ve installed fla_style_switcher but it doesn’t work. Looking at the page source I get:

… link rel=“stylesheet” href=“http://www.mysite.com/textpattern/css.php?n=”latin”” type=“text/css” media=“screen” / …

Note the stylesheet name ”latin”” has extra characters that I can’t figure out where they come from. I haven’t touched the code in any way.

???

In fact, I just noticed that whatever I rename the stylesheet “latin” in the txp command, e.g.:

… txp:fla_style_switcher default=“someotherstylesheetname” /

The page source is stuck with “latin“¨, no matter what…

I’m stumped or just too tired to figure this out. Can anybody help??

Last edited by -rr- (2006-08-22 21:47:26)

Offline

#57 2007-02-16 09:49:04

dog_biscuits
Member
Registered: 2005-10-14
Posts: 10

Re: CSS Chooser

Has anyone else spotted weird requests from Googlebot with this plugin installed?

In my logs, I see entries like the following…

?css=default&request_uri=/?css=default&qs=css=default

/archive/2007/01?css=none&request_uri=/archive/2007/01?css=default&qs=css=default

etc.

However, I can’t find anywhere on my site that such links appear so I don’t know where Googlebot got them from.

Offline

#58 2008-03-24 12:53:48

Rimfya
Member
Registered: 2007-11-22
Posts: 31

Re: CSS Chooser

Does anyone have a copy of this Plugin Still? Would be much appreciated thanks.

rimfya (at) rimfya (dot) comm

Offline

#59 2008-03-24 13:12:04

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: CSS Chooser

Just mailed you :)

Offline

  1. Index
  2. » Archives
  3. » CSS Chooser

Board footer

Powered by FluxBB